jquery ajax 取json对象
$("#bt1").click(function(){$.ajax({url:"hh.aspx?id=1",type:"get",data:null,dataType:"...
$("#bt1").click(function () {
$.ajax({
url: "hh.aspx?id=1",
type: "get",
data: null,
dataType: "json",
cache: false,
beforeSend: function (result) {
},
dataFilter: function (data) {
alert(data);
},
success: function (data) {
alert(data);
alert("aa");
var html = '';
$(result).each(function (i) {
alert("aa");
html += i + "---" + this.name + ":" + this.value;
alert(i + "---" + this.name + ":" + this.value);
});
// for (var i = 0; i < data.length; i++) {
// alert("aa");
// html += i + "---" + result[i].name + ":" + result[i].value;
// alert(i + "---" + result[i].name + ":" + result[i].value);
// }
alert(html);
},
error: function (result, status) {
// alert(result);
if (status == 'error') {
alert("错误");
}
}
}); 展开
$.ajax({
url: "hh.aspx?id=1",
type: "get",
data: null,
dataType: "json",
cache: false,
beforeSend: function (result) {
},
dataFilter: function (data) {
alert(data);
},
success: function (data) {
alert(data);
alert("aa");
var html = '';
$(result).each(function (i) {
alert("aa");
html += i + "---" + this.name + ":" + this.value;
alert(i + "---" + this.name + ":" + this.value);
});
// for (var i = 0; i < data.length; i++) {
// alert("aa");
// html += i + "---" + result[i].name + ":" + result[i].value;
// alert(i + "---" + result[i].name + ":" + result[i].value);
// }
alert(html);
},
error: function (result, status) {
// alert(result);
if (status == 'error') {
alert("错误");
}
}
}); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询