$.ajax({
type : "get",
async:false,
url : url,
dataType : "jsonp",
success : function(data){
var param = data.status;
if ("1" == param) {
window.location.reload();
}
alert(data.message);
},
error:function(){
alert('操作失败');
}
});
服务端:
String cb = request.getParameter("callback");
if (cb != null) {//如果是跨域
StringBuffer sb = new StringBuffer(cb);
sb.append("(");
sb.append(result);
sb.append(")");
}