function testRemote(){
$.ajax({
type : "get",
async:false,
url : "http://192.168.30.36:8080/JavaScriptTools/remoteServlet",
data: {
timeStamp: new Date().getTime(),
password:"123456",
loginName:"changchao"
},
dataType : "jsonp",
jsonp: "callbackparam",//服务端用于接收callback调用的function名的参数
jsonpCallback:"success_jsonpCallback",//callback的function名称
success : function(json){
alert(json);
alert(json[0].name);
},
error:function(){
alert('fail');
}
});
}
response.setContentType("text/html");
String callbackFunName = request.getParameter("callbackparam");
response.getWriter().print(callbackFunName + "([ { 'name':'John'}])");
response.getWriter().flush();
response.getWriter().close();