var serverAddress = location.hostname + ":" + location.port;
var url = "http://" + serverAddress + "/odata/ProductMastersAPI";
$.ajax({
url: url,
async: false,
method: "GET",
success: function (result, textStatus, jqXHR) {
///后台数据
},
error: error
});
function error(data) {
if (data.responseText != "") {
//ShowAlert(data.responseText);
//ShowAlert(data.status);
alert(data.responseText);
alert(data.status);
}
else if (data.readyState == 0) {
// Network error (i.e. connection refused, access denied due to CORS, etc.)
//ShowAlert("连接服务器失败。请确认网络。");
alert("连接服务器失败。请确认网络。");
}
}