mikesta707 Posted October 13, 2009 Share Posted October 13, 2009 is this possible? For example, I have a method in a class that looks like this function ajaxGet(page){ this.xml = GetXmlHttpObject(); if (this.xml == null){ alert("This browser does not support AJAX. You will lose some functionality"); return; } url = page; url += "?q="+this.query+"&t="+document.getElementById(this.ajaxGetId).value; //alert(url); newData = null; this.xml.onreadystatechange = function() { if (this.readyState==4){ newData = new Array(); newData = this.responseText; } //this.fill_table(); } this.xml.open("GET", url, true); this.xml.send(null); //I want to wait till the request completes here before I move forward this.data = newData; this.fill_table(); } im really stumped. New to AJAX so don't really know how to proceed. the reason I dont use this.data=responseText or this.fill_table() is because the methods in my defined javascript class are out of scope in that function. is there a way I could put them in scope? Link to comment https://forums.phpfreaks.com/topic/177594-solved-wait-till-onreadystatechange-function-fires-before-moving-forward/ Share on other sites More sharing options...
mikesta707 Posted October 13, 2009 Author Share Posted October 13, 2009 i got it Link to comment https://forums.phpfreaks.com/topic/177594-solved-wait-till-onreadystatechange-function-fires-before-moving-forward/#findComment-936395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.