ajax getJSON请求 // http GET请求(json类型)function httpGetJSON(url, callback, async) {var xmlhttp;xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");xmlhttp.onreadystatechange = function() {i
// http GET请求(json类型)
function httpGetJSON(url, callback, async) {
var xmlhttp;
xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function() {
if(4 == xmlhttp.readyState && 200 == xmlhttp.status) {
try {
callback(JSON.parse(xmlhttp.responseText));
} catch(e) {
callback(eval("(" + xmlhttp.responseText + ")"));
}
}
};
async = false == async ? false : true;
xmlhttp.open("GET", url, true);
xmlhttp.send();
};
