ExtJS发送AJAX请求:
Ext.onReady(function(){
Ext.Ajax.request({
method:"get",
url:"user.js",
success : function(response){
var jsonData = Ext.JSON.decode(response.responseText);
Ext.each(jsonData,function(item,index){
alert(index+":"+item.name);
});
}
});
});
JQuery发送AJAX请求:
$(document).ready(function() {
$.ajax({
type:"GET",
url:"user.js",
dataType: "json",
success: function(data){
$.each(data,function(i,item){
var content = "<tr>";
content +="<td>"+item.name+"</td>";
content +="<td>"+item.email+"</td>";
content +="<td>"+item.gender+"</td>";
content +="<td>"+item.hobby+"</td>";
content +="</tr>";
$("#result").append(content);
})
}
})
});