请教一个Jquery get/post 跨域请求的问题?
想调用云服务器上的一个接口,传数据跟获取数据,请教下用什么方式跨域请求,如果修改Jquery,谢谢。
<script>
$(function(){
$("#btn2").click(function () {
var accountvalue =document.getElementById("searchaccount").value;
$.ajax({
type: "get",
contentType: "application/json; charset=utf-8",
url: "https://www.baidu.com/Customer.asmx/GetCustomer",//地址被修改掉了。
data: "{customerName:'accountvalue'}",
crossDomain:true==!(document.all),//IE10以下浏览加上这句!!!
dataType: "json",
success: function (json) {
var tbody="";
var obj= eval("("+json.d+")");
var lstCustomer=obj.list;
$.each(lstCustomer,function(n,value) {
var trs = "";
trs += "<tr><td align=center nowrap><a href=javascript:pickup2('"+value.name+"','"+value.id+"');>选择</a></td><td align=center nowrap> "+value.id+" </td> <td align=center nowrap>"+value.name+"</td> <td align=center nowrap>"+value.model+"</td></tr>";
tbody += trs;
});
$("table").append(tbody);
},
error: function (error) {
alert("调用出错" + error.responseText);
}
});
});
});
</script>
...全文


