lnenad Posted December 13, 2008 Share Posted December 13, 2008 I'm using AJAX in combination with PHP to do some stuff and when i try to return the result it doesn't work right. The problem is i have multiple items and multiple result div's. I'm quite capable with PHP and the page is generated like i want it to be, but i stink with JS so i can't find the problem function dc(id) { var idd = "rez"+id; xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url = "dc.php?id="+id; xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById(idd).innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } I'm blind, i haven't noticed the AJAX help board below lol please MOD's move this topic sorry for the trouble. Please help . Quote Link to comment Share on other sites More sharing options...
Adam Posted December 14, 2008 Share Posted December 14, 2008 Try this... xmlHttp.onreadystatechange=function() { stateChanged(idd); } You'll need to modify the stateChanged function.. function stateChanged(idd) { A Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.