Problem description: Hello !
My XMLHTTPRequest object, when ready, does a couple of things, as in, the responseText which i receive, is split up, and sent as a parameter to myFunction() Now, i need to call myFunction() 'n' number of times, with substrings of the response text as parameters.
This Works: strong>
myAjaxObj.onreadystatechange=function()
{
if(myAjaxObj.readyState==4)
{
if(myAjaxObj.status==200)
{
myFunction( myAjaxObj.responseText, id )
This DOESNT Work: strong>
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 within the for-loop wont run, unless the alert() is uncommented. Ive read somewhere about javascript closures, and the facts that it kinda gives the execution/rendering to get in sync
Ne çözüm olurdu?