I'm launching the below javascript with an onChange event in the html:
<select name="date" onChange="showUser(this.value)">
I've verified that the onChange event is getting to the javascript by doing a simple alert("working"); and IE did fire up the alert, however the actual code that I want does not seem to work. (its functional in FF, Chrome, Safari, iPad, and Android).
What the function does is: take the value passed to it through the onchange, and send it to a php file as a variable. The php file takes the variable it gets and inserts it into a DB. I don't think the php portion is the problem because it works in every other browser. Does anyone have any insight?
Code:function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://testest.com/itgoeshere.php?q="+str,true); xmlhttp.send(); }
I realize that have to explicitly add value attributes to each <option> tag, as you must do so for I.E. But I believe I have done this...
Here's an example for what the select statement looks like...
<select name="date" onChange="showUser(this.value)">
<option value="">---</option>
<option value="1">Past hour</option>
<option value="2">Past week</option>
<option value="3">Past month</option>
<option value="4">Past year</option>
</select>
I


Reply With Quote
Bookmarks