Hi

I have a simple jsp page in which there is an ajax call on an input string which returns the upper case of the string in json. This is working for the first time but not on successive requests. I am using the GET method.

Why is it not working for multiple requests?

Help needed.

thanks

Abhik

Recommended Answers

All 7 Replies

Most likely the Ajax result is being cached; append a random tidbit to your URL, preferably something like timestamp to have a distinct URL for each request to prevent this caching. If you are using an URL like /YourApp/Upper append it with /YourApp/Upper?t=timestamp .

Thing is i want the AJAX request to be sent on each onclick of the button . this is now only happening on the first instance of the click. If I refresh the page then it happens again, else not. This is due to the fact that there is

AJAX.onreadystatechange = handler

where var AJAX has the xmlhttprequest.

Now the ready state is 4 when the data is loaded from the server and since its value is not changing so the handler function is not getting called.So is there any way to change the status after every server response or any other alternate way?

Did you try out the suggestion in my previous post?

i have nt tried it out yet..do u mean that i shall give an interval say in milliseconds ,so that 2 clicks will be possibly take more time than the interval?

I've already explained it in my previous post; also read this.

Your solution looked interesting and I believe it will work but as of now it is not working . My code is :

function show() 
	{
        var x = document.getElementById('inValue').value;

         AJAX.onreadystatechange = handler;
         
		 AJAX.open("GET","inputProcess.jsp?var="+x+"&psuedoParam="+new Date().getTime());
		 AJAX.send("");
	}

I am sending a new param on each request but since the ready state is not changing the handler is not getting called .Any suggestions?

ok cool i solved it put

AJAX.onreadystatechange = handler;

after the call.

Thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.