Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use AJAX in IE
    text
    copied!<p>i'm using IE and I need to do a simple AJAX that will display a table with values from the database once a dropdown has been changed.</p> <p>Here is my script:</p> <pre><code>&lt;script type="text/javascript"&gt; function getXML() { var req; try { req = new XMLHttpRequest(); } catch (trymicrosoft) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { req = null; } } } if (!req){ return null; } else { return req; } } function filter(month, year) { if(getXML()){ var xmlhttp = getXML(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("mandayTable").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax/filterMandays.php?m="+month+"&amp;y="+year,true); xmlhttp.send(); } else { alert("Error initializing XMLHttpRequest!"); } } &lt;/script&gt; </code></pre> <p>and here is my ajax php</p> <pre><code>&lt;?php $q = "SELECT md.mandays_id,md.employeenum,md.month,md.year,md.required_man_days,d.firstname,d.lastname FROM tbl_mandays md,tbl_employee_details d WHERE md.active = '1' AND md.employeenum = d.employeenum AND md.month = '10';"; //employee_details WHERE approver = 0" $res = $db-&gt;Execute($q); echo "&lt;table border = 1&gt;"; echo "&lt;tr&gt;&lt;th&gt;Employee Number&lt;/th&gt;&lt;th&gt;First Name&lt;/th&gt;&lt;th&gt;Last Name&lt;/th&gt;&lt;th&gt;Month-Year&lt;/th&gt;&lt;th&gt;Required Man Days&lt;/th&gt;&lt;th&gt;Edit/Delete&lt;/th&gt;&lt;/tr&gt;"; /while($rows = $res-&gt;FetchRow()) for($i=0;$i&lt;5;$i++) { $mandays_id = $rows[0]; $empnum = $rows[1]; $month_year = $rows[2] ."-" .$rows[3]; $required_man_days = $rows[4]; $firstname = $rows[5]; $lastname = $rows[6]; echo "&lt;tr&gt;&lt;td&gt;".$empnum . "&lt;/td&gt;&lt;td&gt;".$firstname ."&lt;/td&gt;&lt;td&gt;".$lastname ."&lt;/td&gt;&lt;td&gt;" . $month_year ."&lt;/td&gt;&lt;td&gt;" .$required_man_days . "&lt;/td&gt;&lt;td width = \"200\" align = \"center\"&gt;&lt;a href = 'edit_mandays.php?mandays_id=$mandays_id');'&gt;Edit/Delete&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/table&gt;"; ?&gt; </code></pre> <p>THe problem is that on the first "ONCHANGE" it does not do anything. on the 2nd "ONCHANGE" the headers of the table in the php code is the only one that's being echoed.</p> <p>I alsoi tried doing it without the query and changing the loop into for($i=0;$i&lt;5;$i++) and changed the qvalues to be displayed into "1" but still it does noty go into the loo[ and display it.</p> <p>what seems to be the problem? :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload