ajax总结
发布时间:2020-12-15 21:31:36 所属栏目:百科 来源:网络整理
导读:ajax总结 参数 扩展 getJSON get ajax总结 参数 $.ajax({ url : "delTerminalAction.action/config.json",type : "post/get",async : false,//表示同步 traditional : true,// 这样就能正常发送数组参数了 dataType : "json/xml/text/html",contentType: "ap
ajax总结参数$.ajax({ url : "delTerminalAction.action/config.json",type : "post/get",async : false,//表示同步 traditional : true,// 这样就能正常发送数组参数了 dataType : "json/xml/text/html",contentType: "application/x-www-form-urlencoded; charset=utf-8",//设置编码 data : { "ids" : ids,},success : function(data) { $.each(data,funtion(i,item){ alert(item[i]); //或者是 alert(item.tagName); }); },error : function() { alert("删除失败!!"); } }); 扩展get了一个新技能,mark一下。 options = { type : "get/post",datatype:"json",success : function(){ alert("success"); } } $.ajax($.extend(options,{ url : "rest/user/queryAll",data : { "name":"chenchen" } })) $.getJSON// $.getJSON相当于$.ajax方法中dataType值为json时的简化 $.getJSON(url,function(data){ ... }) $.get//可获取int型非json数据 $.get(url,function(){ }) 原文不定时更新,具体详情请查看ajax总结 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |