首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

ajax在后台如何获取data值

2012-10-13 
ajax在后台怎么获取data值?JScript codeoptions {type: POST,url: ajaxPage,data:{Formula:escape(t

ajax在后台怎么获取data值?

JScript code
options = {                    type: "POST",                    url: ajaxPage,                    data:{"Formula":escape(textarea),"FieldNames":escape(fieldNames)},                    contentType: "application/json;charset=utf-8",                    dataType: "string",                    async: false                };                returnText = $.ajax(options).responseText;

后台onLoad事件
C# code
if (Request["mn"] != null && Request["mn"] == "Detection")                {                    Response.ContentType = "application/json";                    Response.Write(IsExist());                    Response.End();                }


在if里面怎么获取data的值?

[解决办法]
取消escape,jq已经自动用encodeURIComponent编码过一次了

JScript code
options = {                    type: "POST",                    url: ajaxPage,                    data:{"Formula":textarea,"FieldNames":fieldNames},///////////                   // contentType: "application/json;charset=utf-8",//不要设置contentType为这个,要不服务器端生成不了键值对                    //dataType: "string",//dataType没有string类型,不过设置为这个也行,会自动变为text                    dataType: "text",                    async: false                }; 

热点排行