jquery getjson works fine in mac, and fails in windows
Posted
by viper
on Stack Overflow
See other posts from Stack Overflow
or by viper
Published on 2010-06-09T14:39:07Z
Indexed on
2010/06/09
14:42 UTC
Read the original article
Hit count: 243
this code loads the data
jQuery.ajax({
type: "GET",
url: "getOptionsJson.php",
cache: false,
dataType: "json",
data: "config_id="+config_id,
success: function(json) {
jQuery.extend(dataArr, json.ajax);
jQuery.extend(opts, json.ajax2);
printResult(config_id);
},
error: function() {
alert('Error. Please try again');
location.reload();
}
});
this code generates it
<?php
header('Content-type: application/javascript');
echo json_encode(array(
"ajax" => array(1 => "test", 2 => "test 2"),
"ajax2" => array(1 => "test 3", 2 => "test 4")
);
?>
when im working on mac, everything goes fine, but today i tried it on widnows, and it doesnt work. the code flows like its success, but opts and dataArr are null
i tried all headers (application/json, text/html, etc) i checked if getOptionsJson.php is called correctly via mail function filnally firebug says that im getting response, but theres no content and file is just 1kb
i tried even changing datatype to xml, still fails
ie gives a hint, it says 'there's error on site' which reffers to 127 line of jquery file
any idea?
© Stack Overflow or respective owner