2016-09-02 99 views
0

我有以下代碼,我想從服務中獲取數據。我已經設置了一切,從我得到谷歌。無法調用Ajax調用來獲取服務中的數據

function checkLicense() { 
debugger 
try { 
    var _name = "aaa-bcs-edt"; //location.host; 
    $.ajax({ 
     type: "POST", 
     url: "http://mdc.abc.com/LicenseWebService.svc/IsLicenseValidByName", 
     data: '{"DName":"' + _name + '"}', 
     contentType: "application/json; charset=utf-8", 
     crossDomain: true, 
     dataType: "json", 
     async: false, 
     success: function (msg) { 
      debugger 
      var data = msg.d; 
      if (data == "success") { 
       licenseactivated = "success"; 
      } 
      else { 
       licenseactivated = "Fail"; 
      } 
     }, 
     error: function (XMLHttpRequest, textStatus, errorThrown) { 
      debugger 
      alert(errorThrown.toString()); 
     } 
    }); 
} catch (err) { 
    debugger 
    alert(err.message.toString); 
} 

頭:

<head> 
    <title>Create Purchase Order</title> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta> 
    <meta> 
    <meta> 
</head> 

這裏是控制檯日誌,錯誤: enter image description here

可有人請建議我嗎?

回答