Welcome Guest, Not a member yet? Register   Sign In
Problem in IE with ajax

Hi friends,
I have problem with internet explorer while executing ajax with php..Mozilla support it and there is no problem but Internet Explorer(version 5,6,7+) didn't support the same one.Is ajax depend on browser?...I have attached codes here..Someone please help me...Thanks in advance....I am waiting for your reply.......


<!--scripting code---javascript-->
function showUser(form)
count = document.srch.country.value
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp.readyState==4 && xmlhttp.status==200)
var url="getstate.php";

<!--scripting code---javascript ends here-->
<form name="srch" action="" method="post">
<table border="0" cellpadding="7" class="font">

<tr><td class="font">Country</td><td class="font"><select name="country" class="font"><option value="">--Select--</option>
$ctry = mysql_query("select distinct country from tbl_location") or die(mysql_error());
while($resc = mysql_fetch_row($ctry))
echo "<option value='$resc[0]'>$resc[0]</option>";

<tr><td class="font" valign="top">State</td><td class="font"><div id="txtHint" class='font1'><select name="state" class="font"><option value="">--Select--</option>

<tr><td colspan=2 align=center>&lt;input type="submit" name="submit" value="Submit"&gt;&lt;/td></tr>



$id = $_GET["id"];

$sql = mysql_query("select distinct state from tbl_location where country='$id' order by state asc") or die(mysql_error());
$sql1 = mysql_query("select distinct city from tbl_location where country='$id' order by city asc") or die(mysql_error());
$sql2 = mysql_query("select distinct place from tbl_location where country='$id' order by city asc") or die(mysql_error());

echo "&lt;form&gt;";
echo "<select name='state' class='font'>";
echo "<option value=''>--Select--</option>";

echo "<option value='$val[0]'>$val[0]</option>";
echo "</select>";

echo " City <select name='city' class='font'>";
echo "<option value=''>--Select--</option>";
echo "<option value='$cit[0]'>$cit[0]</option>";
echo "</select>";

echo " <br/><br/>Place<select name='place' class='font'>";
echo "<option value=''>--Select--</option>";
echo "<option value='$pla[0]'>$pla[0]</option>";
echo "</select>";
echo "&lt;/form&gt;";


Use a js library to take care of all the silly quirks of every browser. jQuery is a good starting point.

You seem to be using native JS, but my first recommendation would be to try and stick with a JS framework such as jQuery, therefore browser inconsistencies are handled in the framework, thus eliminating your problems Smile

if your problem for a dynamic dropdowns ( city + state ) this post helps you

--&gt; http://tidoc.wordpress.com/

Sorry for my english..

Theme © iAndrew 2016 - Forum software by © MyBB