52,797
社区成员
发帖
与我相关
我的任务
分享
<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>
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "https://www.baidu.ink/ProjectService.asmx/CreateProject",//地址被修改掉了。
//data:{"jsonStr":jsontr},
data:jsontr,//var jsontr = JSON.stringify(object);
crossDomain:true==!(document.all),//IE10以下浏览器需 加上这句!!
success: function () {
//console.log(data);
alert("调用成功:");
alert(data);
},
error: function () {
alert("调用失败:");}
});
});
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "https://www.baidu.ink/ProjectService.asmx/CreateProject",//地址被修改掉了。
//data:{"jsonStr":jsontr},
data:jsontr,//var jsontr = JSON.stringify(object);
crossDomain:true==!(document.all),//IE10以下浏览器需 加上这句!!
success: function () {
//console.log(data);
alert("调用成功:");
alert(data);
},
error: function () {
alert("调用失败:");}
});
});
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/>
<add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>