www.webdeveloper.com
Results 1 to 2 of 2

Thread: Call to php not working in IE

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Call to php not working in IE

    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

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles