$.ajax异步操作的get或post提交
$.ajax异步操作的get或post提交,在我此时的项目中特别常用,下面我就整理了一下,进行一下小结。 第一种形式:get形式。
$.ajax({ Url:"",Type:"get",Data:{ operType:"query",listType:"AgreementType" },dataType:"json",Success:function(data){ Alert("成功后相应的操作!"); },Error:fucntion(error){ Alert("操作失败的操作 !"); } }); 第二种形式:post形式。
$.ajax({ Url:"../Handler/AgreementHandler.ashx",Type:"post",Data:{ operType: "query",listType:"AgreementType" } dataType:"json",Error:function(error){ Alert("操作失败的操作 !"); } }); 第三种形式:包含get或post操作的,混合模式。
$.ajax({ //这种是一种get提交 Url:"../Handler/AgreementHandler.ashx?userName=huxiaojie&password=123456",//post提交 Data:{ operType: "query",Error:function(error){ Alert("操作失败的操作 !"); } }); 这三种模式是我开发中经常用到的,他们用的是一套模板,只是他们的提交方式有所不同。
小结: get和post的区别:
这一块的知识,还很欠缺,也在不断的学习当中;如果有错误,敬请指正。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |