标签:
ajax跨域访问:
1.前台:
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("股东卡号已存在");
return false;
}
},
error:function(XHR, textStatus, errorThrown){
//alert(‘error: ‘ + errorThrown);//not login
},
timeout:5000
});
} catch(ex) {
alert("erorr");
}
2.后台:
/*
* 查询股东卡号是否存在
*/
@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 + ")");
}
标签:
原文地址:http://blog.csdn.net/shandalue/article/details/42104169