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

[eluser]Joviac[/eluser]
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.......

------sample.php----------

<?php
include("./property/connection.php");
?>
<html>
<head>
<!--scripting code---javascript-->
[removed]
function showUser(form)
{
count = document.srch.country.value
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")[removed]=xmlhttp.responseText;
}
}
var url="getstate.php";
url=url+"?id="+count;

xmlhttp.open("GET",url,true);
xmlhttp.send();
}
[removed]
<!--scripting code---javascript ends here-->
</head>
<body>
<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>
&lt;?php
$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>";
}
?&gt;

</select>
</td></tr>
<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>
</select></div></td></tr>

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

</table>
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

----------getstate.php------------

&lt;?php
include("./connection.php");
$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>";

while($val=mysql_fetch_row($sql))
{
echo "<option value='$val[0]'>$val[0]</option>";
}
echo "</select>";

echo " City <select name='city' class='font'>";
echo "<option value=''>--Select--</option>";
while($cit=mysql_fetch_row($sql1))
{
echo "<option value='$cit[0]'>$cit[0]</option>";
}
echo "</select>";

echo " <br/><br/>Place<select name='place' class='font'>";
echo "<option value=''>--Select--</option>";
while($pla=mysql_fetch_row($sql2))
{
echo "<option value='$pla[0]'>$pla[0]</option>";
}
echo "</select>";
echo "&lt;/form&gt;";
?&gt;

-----------------
#2

[eluser]n0xie[/eluser]
Use a js library to take care of all the silly quirks of every browser. jQuery is a good starting point.
#3

[eluser]georgeedwards[/eluser]
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
#4

[eluser]Unknown[/eluser]
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