Debt Consolidation - Debt Consolidation - Myspace Layouts - Find jobs - Submit articles

PDA

View Full Version : jQuery ajax not working in IE???


M.Zeb Khan
Oct 17th 2008, 6:11 pm
Hi,

It's a jQuery script which updates <select> drop down on the spot....

It's working perfect in GoogleChrome and FF, but this damn IE, its not working.


Here is the jQuery code....

$(function(){
$("select#State").change(function(){
$.getJSON("cities.php",{id: $(this).val(), dataType: "json", ajax: 'true'}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#City").html(options);
})
})
})


Here is the PHP code of cities.php

$result = $db->query("SELECT * FROM us_cities WHERE ST = '$_GET[id]' ");

echo "[ ";
while($grab = $db->fetch_array($result)) {
echo "{optionValue: '$grab[City]', optionDisplay: '$grab[City]'},";
}
echo " ]";



It works perfectly!! in FF, I hate Internet Explorer