2016-09-02 59 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

可有人请建议我吗?

回答