Description of the problem: Hello!
My XMLHTTPRequest object, when ready, does a couple of things, like in, the responseText that I get is split and sent as the parameter myFunction () Now I need to call myFunction () 'n' the number of times, with substrings of the response text as parameters .
Working:
myAjaxObj.onreadystatechange=function()
{
if(myAjaxObj.readyState==4)
{
if(myAjaxObj.status==200)
{
myFunction( myAjaxObj.responseText, id )
This DOESNT work:
myAjaxObj.onreadystatechange=function()
{
if(myAjaxObj.readyState==4)
{
if(myAjaxObj.status==200)
{
var count i=0;
for( i=0; i < 5; i++ )
{
[b]alert("Without this it wont work") [/b]
myFunction( myAjaxObj.responseText, i );
}
Basically, the code inside the for-loop does not run unless alert () is displayed. Ive read somewhere about closing javascript, and the facts that it somehow provides execution / rendering in order to sync
What will be the solution?
source
share