Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem in refreshing the page after making two ajax calls
    text
    copied!<p><strong>Problem</strong> I am making ajax call to server1 i.e. csce and once I got the response I am sending the response as contents to server2 i.e.yahoo server after getting response from there I want to refresh the page or atleast redirect it to the same page. Both ajax calls are working fine. The contents I am sending are also saved the only problem is that I have to manually refresh the page to see the changes. I want to refresh the page once the contents are saved on yahoo. I tried <strong>reload</strong> and <strong>redirect</strong> commands in success function of yahoo. But nothing works. I can see the both ajax calls in the HTTPfox but not the redirect.</p> <p>The url from which i am making calls is different from the url where contents are saved thats why I need to refresh the page to see the changes. i.e. I am saving in yahoo/save while sending contents and seeing changes at yahoo/edit.</p> <p>I am not sure where I am going wrong. Here is my code I am using. Can anyone suggest where I am going wrong. If my problem is not clear kindly do ask me to clarify more. Thanks.</p> <p>This code is the code:</p> <pre><code> function handleButtonClick() { // Declare the variables we'll be using var xmlHttp, handleRequestStateChange; // Define the function to be called when our AJAX request's state changes: handleRequestStateChange = function() { // Check to see if this state change was "request complete", and // there was no server error (404 Not Found, 500 Server Error, etc) if (xmlHttp.readyState==4 &amp;&amp; xmlHttp.status==200) { var substring=xmlHttp.responseText; alert(substring);// I am able to see the text which is returned by the server1 i.e csce var handleSuccess = function(o) { if(o.responseText !== undefined) { console.log(o.responseText); **window.location.reload()** // also I tried to redirect it to the same site but that also not works } }; var callback ={ success:handleSuccess, failure: function(x) { console.error(x) }, argument: ['foo','bar']}; var request = YAHOO.util.Connect.asyncRequest('POST','http://yahoo.com******', callback, substring); } } xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", "http://cse*****id=c6c684d9cc99476a7e7e853d77540ceb", true); xmlHttp.onreadystatechange = handleRequestStateChange; xmlHttp.send(null); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload