Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

asp.net cross domain in Chrome

I have below codes with cross domain issue in Chrome and Firefox.
And I did install below links from Chrome but still not working.

However, IE working with enable the cross domain under Internet Option >> Security Tab

Any ideas

function GetModelList(divisCode)
      var customerNo = "315217";            
        var GetModelListJSon = "http://clientaccesstest.abc/GetModel";            
        $(document).ready(function () {
            $.ajax({
                cache: false,
                type: "GET",
                async: false,
                dataType: "json",
                contentType: 'text/plain',
                url: GetModelListJSon + encodeURIComponent("(011,115217)"),
                success: function (data) {
                    $('#data').html(data);
                    if (data == null)
                        return;
                    resultObj = jQuery.parseJSON(data);
                    if (resultObj.Status != 'Failed') {
                        $('#json').html(setModelInfo(resultObj.Data,divisCode));
                    }
                },
                error: function (xhr,status,error) {
                    $('#data').html(xhr.responseText);
                    alert(xhr.responseText + " : error GetModelListJSon");
alert(status);
alert(error);
                }
            });
        });
}


https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en
https://chrome.google.com/webstore/detail/forcecors/oajaiobpeddomajelicdlnkeegnepbin/related?hl=en

http://codedevstuff.blogspot.com/2014/10/use-chrome-for-development-and-allow.html
Avatar of Ravi Vaddadi
Ravi Vaddadi
Flag of United States of America image

use

dataType: "jsonp" in place of dataType: "json" and try
Avatar of ITsolutionWizard

ASKER

add dataType: : "jsonp" - The error still occurs.

Thank you for your time to help ....
please try this
function GetModelList(divisCode)
      var customerNo = "315217";            
        var GetModelListJSon = "http://clientaccesstest.abc/GetModel";            
        $(document).ready(function () {
            $.ajax({
              crossDomain: true,
                cache: false,
                type: "GET",
                async: false,
                dataType: "json",
                contentType: 'text/plain',
                url: GetModelListJSon + encodeURIComponent("(011,115217)"),
                success: function (data) {
                    $('#data').html(data);
                    if (data == null)
                        return;
                    resultObj = jQuery.parseJSON(data);
                    if (resultObj.Status != 'Failed') {
                        $('#json').html(setModelInfo(resultObj.Data,divisCode));
                    }
                },
                error: function (xhr,status,error) {
                    $('#data').html(xhr.responseText);
                    alert(xhr.responseText + " : error GetModelListJSon");
alert(status);
alert(error);
                }
            });
        });
}
add crossDomain: true, the problem still does not resolve....
ASKER CERTIFIED SOLUTION
Avatar of Ravi Vaddadi
Ravi Vaddadi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial