jquery ajax 跨域请求
来源:互联网 发布:viuvo无法访问移动网络 编辑:程序博客网 时间:2024/04/29 09:22
使用 jquery 中的ajax 进行跨域请求
说明:dataType 为 "jsonp" ;type 只能为 GET
前台请求代码
$.ajax({
type: "GET",
url: "http://www.xxx.com/Rest/ValidAccountsExists.aspx?accounts=admin",
dataType: "jsonp",
jsonp: "jsoncallback",
success: function (result) {
alert(result.Success);
alert(result.Content);
},
error: function (result, status) {
//处理错误
}
});
后台处理代码 ValidAccountsExists.aspx
string accounts = GameRequest.GetQueryString("accounts");
string jsoncallback = GameRequest.GetQueryString("jsoncallback");
Response.ContentEncoding =System.Text.Encoding.UTF8;
Response.ContentType = "application/json";
Response.Write(jsoncallback + "({\"Success\":\"True\",\"Content\":\"" + accounts + "\"})");
Response.End();
- jquery ajax 跨域请求
- jQuery Ajax 跨域请求
- Jquery AJAX 跨域请求
- jQuery Ajax 跨域请求
- jquery ajax跨域请求
- jQuery ajax跨域请求
- 用jquery的ajax跨域请求
- jQuery ajax跨域异步请求
- jQuery中ajax跨域请求
- 用jquery的ajax跨域请求
- jQuery ajax跨域异步请求
- JQuery的Ajax跨域请求要义
- jQuery的Ajax跨域请求
- JQuery的Ajax跨域请求的
- jQuery ajax jsonp实现跨域请求
- php + jquery ajax 跨域请求
- jquery+ajax实现跨域请求
- jquery之ajax跨域请求
- Java中Class对象详解
- UVa 10494 - If We Were a Child Again
- 题目81:确定比赛名次
- 分布式计算中的缺陷
- Spring Batch学习笔记
- jquery ajax 跨域请求
- 回想高中时读绝影写的书,随想一篇
- OOA/OOD 面向对象分析与设计
- SeekBar用法
- MVVM中轻松实现Command绑定(三)任意事件的Command
- 在shell中建立快捷命令
- php中关于||(或者符号)的四种情况分析
- Androidの网络通信之TDP
- boss2技能设定。电脑被无耻地剥夺了,只能用这个写