I have a page on which I am calling an ajax function to do some processing on the server, during the processing the page just displays a loading icon. I have an iframe on the same page, the purpose of this iframe is to get some information from server and display it in the iframe using jQuery Ajax.
The problem that I am having is, the iframe is not updating until the first function call is completed... Is the browser blocking multiple ajax calls or is there something I am missing?
Here is the code:
The call that is made on开发者_运维知识库 the main page: it is done on document.ready. It is calling the same file with a new querystring
$.ajax({
url: window.location.href + '&Process=1',
context: document.body,
success : function(response){
window.location.href = response;
}
});
The page in the iframe: It calls a function after every 2 seconds to fetch data from server
window.setTimeout(FetchStatus,1000);
function FetchStatus(){
$.ajax({
url: 'WebForm1.aspx?Act=Status',
context: document.body,
success : function(response){
$('#ratorSt').html(response);
}
});
window.setTimeout(FetchStatus,1000);
}
usually, you can run multiple ajax request in the same time... Did you try using :
$.ajax({
....
async:false,
... });
It's not a good solution but just try it :)
http://api.jquery.com/jQuery.ajax/
url: window.location.href + '&Process=1',
This may be causing problems if your URL does not already have a querystring. May need some logic about whether to put a '?' or an '&'.
精彩评论