0 votes
in Education by (1.7m points)
I have following code and I want to get data from service. I have set everything from what I get Google.

function checkLicense() {


try {

    var _name = "aaa-bcs-edt"; //location.host;


        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) {


            var data = msg.d;

            if (data == "success") {

                licenseactivated = "success";


            else {

                licenseactivated = "Fail";



        error: function (XMLHttpRequest, textStatus, errorThrown) {





} catch (err) {






    <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">





Here is the console log with error:

Can anybody please suggest me?

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
You need to enable cors headers in the server side.