I am completely new to AJAX, so I got this code from another site and installed it for what I need. It works great if I have only one form on the page ... however, once I have multiple forms on the page, it stops working but it doesnt throw an error code, so I have no clue where to look. Any help would be appreciated!
Select Field Code:
Ajax.js:Code:onChange="showField(this.value, 'QQTrim')"
Code:function GetXmlHttpObject() { var xmlHttp=null; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function showField(str, id){ var url="inc/ajaxforms.php" url=url+"?modField="+id url=url+"&modString1="+str url=url+"&sid="+Math.random() xmlHttp=GetXmlHttpObject(); xmlHttp.onreadystatechange= function() { if (xmlHttp.readyState==4) if (xmlHttp.status==200) writeHTML(xmlHttp, id); } xmlHttp.open("GET",url,true); xmlHttp.send(null); } function writeHTML(req, id) { document.getElementById(id).innerHTML = req.responseText; }


Reply With Quote


Bookmarks