1

getting error Origin file:// is not allowed by Access-Control-Allow-Origin.

There is Ajax call , here is the code of ajax

var req = $.ajax({
            url: SOAPURL,
            data: soapxml,
            type: 'POST',
    crossDomain: true,
            DataType:'XML'
            async: true,
            headers: soaphdr, 
            contentType: 'text/xml; charset=UTF-8'
        });

as searched in web , i have added

 $.mobile.allowCrossDomainPages = true;
   $.support.cors = true;

but this isnt helping , there are lot of unanswered questions on the same , adding one more in hope of getting answer

thanks in advance

  • possible duplicate of [XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin](http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin) – Ray Nicholus Jun 09 '14 at 14:43
  • Read the [first answer of the duplicate question](http://stackoverflow.com/a/3744697/486979) carefully. An explanation/answer for your issue is there. Also, you should not be overriding support flags in jQuery, that's not their intent at all. These are set internally based on the capabilities of the browser. – Ray Nicholus Jun 09 '14 at 14:44

1 Answers1

0

Use Google Chrome, search for extension: Allow-Control-Allow-Origin and keep it enabled whenever you are working with requests. In case sometime it crashes, disable/re-enable it and it works.

EddyG
  • 2,051
  • 3
  • 22
  • 46