php - ajax script doesn't work in IE -
i have problem ajax script in ie, because doesn't work, works in ff , chrome in ie doesn't work! there 2 drop down boxes , according have selected in first 1 second dropdown box show values selected city.
<select class="selectdest" name="prej" onchange="getstate(this.value)"> <option></option> '.funksionet::all_directions().' </select>
this second dropdown box:
<div id="statediv"><select class="selectdest" name="deri"> <option></option> </select></div>
this ajax function:
<script language="javascript" type="text/javascript"> function getxmlhttp() { //function return xml http object var xmlhttp=false; try{ xmlhttp=new xmlhttprequest(); } catch(e) { try{ xmlhttp= new activexobject("microsoft.xmlhttp"); } catch(e){ try{ xmlhttp = new activexobject("msxml2.xmlhttp"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getstate(countryid) { var strurl="findstate.php?country="+countryid; var req = getxmlhttp(); if (req) { req.onreadystatechange = function() { if (req.readystate == 4) { // if "ok" if (req.status == 200) { document.getelementbyid(\'statediv\').innerhtml=req.responsetext; } else { alert("there problem while using xmlhttp:\n" + req.statustext); } } } req.open("get", strurl, true); req.send(null); } } </script>
this findstate.php file:
<?php require_once 'includes/constants.php'; $country = $_get['country']; $link = mysql_connect(db_server, db_user, db_password); //changet configuration in required if (!$link) { die('could not connect: ' . mysql_error("1")); } mysql_select_db(db_name); $query="select * costs prej = '$country';"; $result=mysql_query($query) or die("2"); ?> <select class="selectdest" name="deri"> <option></option> <?php while($row = mysql_fetch_array($result)) { print'<option>'.$row['deri'].'</option>'; } ?> </select>
i need make work, appreciate if going me on this. because not javascript! if there no way can cross-browser know , wont make way.
$country = $_get['country']; $query="select * costs prej = '$country';";
i know, offtopic, not
Comments
Post a Comment