JQUERY的AJAX跨域请求
- 格式:pdf
- 大小:50.61 KB
- 文档页数:1
JQueryµÄAjax¿çÓòÇëÇó
¿Í»§¶Ë£º
$.ajax({
type : "get",
url : "${base1}/mobile.do?method=indexCase", async :
false,
dataType : "jsonp",
jsonp: "callbackparam",
jsonpCallback:"success_jsonpCallback", success :
function(data){
$("#itemComBusDiv").html(data.content); },
error:function(){
alert('fail');
}
});
·þÎñÆ÷¶Ë£º
response.setContentType("text/html; charset=utf-8");
PrintWriter out=null;
out=response.getWriter();
String callbackFunName =
request.getParameter("callbackparam"); String jsonString =
"{content:'"+sb.toString()+"'}";
out.write(callbackFunName +
"("+jsonString+")");