前端:$.ajax({
url: 'http://lifeloopdev.info/get_events',
dataType: "jsonp",
data: "offset=0&num_items=10",
username: 'username',
password: 'password',
success: function (data) {
$.each(data.success, function (i, item) {
$("body").append('<h1>' + item.title + '</h1>');
});
}
});服务器端:
Response.ContentType="text/html; charset=utf-8";
String callback = Request.QueryString["callback"].ToString();
Response.Write(callback + "{ \"success\": [{ \"id\": 1, \"title\": \"title 1\" }, { \"id\": 2, \"title\": \"title 2\" }, { \"id\": 3, \"title\": \"title 3\"}] }");
url: 'http://lifeloopdev.info/get_events',
dataType: "jsonp",
data: "offset=0&num_items=10",
username: 'username',
password: 'password',
success: function (data) {
$.each(data.success, function (i, item) {
$("body").append('<h1>' + item.title + '</h1>');
});
}
});服务器端:
Response.ContentType="text/html; charset=utf-8";
String callback = Request.QueryString["callback"].ToString();
Response.Write(callback + "{ \"success\": [{ \"id\": 1, \"title\": \"title 1\" }, { \"id\": 2, \"title\": \"title 2\" }, { \"id\": 3, \"title\": \"title 3\"}] }");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货