mr.glue Posted December 11, 2006 Share Posted December 11, 2006 hi,I have a script which works fine, up until I call it after a certain action - then every time I call that script it doesn't eved ([color=gray]xmlHttp.readyState==4 || xmlHttp.readyState=="complete"[/color] NEVER TRUE). From some reason, this action (which executes perfectly as far as I know) stucks the first action, which works fine until the second executes.[code]function getPage(section, url, params) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } switch(section) { case "addcomment": -- second action, which stucks the comments list elemID = "comError" xmlHttp.onreadystatechange=resultAddComment break case "commentslist": elemID = "txtComments" -- first action: works perfectly until addcomment executes xmlHttp.onreadystatechange=gotComments break } xmlHttp.open("POST",url,true) xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", params.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(params)}... getPage("commentslist","actions/GetComments.asp", "appropriate_params_here"); // execute 1st action - workds perfectly getPage('addcomment', 'actions/AddComment.asp', "appropriate_params_here"); // execute 2nd action getPage("commentslist","actions/GetComments.asp", "appropriate_params_here"); // execute 1st action -- doesn't work now... readystate never complete/4[/code] Link to comment https://forums.phpfreaks.com/topic/30211-ajax-script-doesnt-end-readystate-not-turning-4/ Share on other sites More sharing options...
ober Posted December 11, 2006 Share Posted December 11, 2006 I'm not sure what this:xmlHttp.setRequestHeader("Connection", "close");Even does, unless that is similar to the "abort" command.Secondly, where is your function to return the content? I don't even see a call to any kind of handler. Link to comment https://forums.phpfreaks.com/topic/30211-ajax-script-doesnt-end-readystate-not-turning-4/#findComment-138998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.