Ajax cross-Domain access:
1. Front Desk:
Try{
$.ajax ({
Async:false,
Cache:false,
data:{"vote_id": vote_id,"Shareholder_card": Shareholder_card,"Stock_type": Stock_type ,"Currency_type": Currency_type},
Url:sivrs_hascard_url,
DataType:' Jsonp ',
JSONP: "Callback",
Success:function(result) {
var results=eval (Result)
var result=results.result;
if (Result = = 1) {
Alert ("the shareholder card number already exists");
Returnfalse;
}
},
Error:function(XHR, Textstatus, Errorthrown) {
//alert (' ERROR: ' + errorthrown);//not Login
},
timeout:5000
});
} catch(ex) {
Alert ("Erorr");
}
2. Backstage:
/*
* Check if there is a shareholder card number
*/
@RequestMapping(value="/hascard.do")
Public void Hascard (httpservletrequest request,
HttpServletResponse response, model model) {
String vote_id =request. GetParameter ("vote_id");
String Shareholder_card =request. GetParameter ("Shareholder_card");
String Stock_type =request. GetParameter ("Stock_type");
String Currency_type =request. GetParameter ("Currency_type");
String callback = Request.getparameter ("callback");
String result = Jedisservice . Hascard (vote_id, Shareholder_ Card,stock_type,currency_type);
Jsonajax (response, Callback + "(" + result + ")");
}
Ajax cross-domain access JSONP