0

I get the following error when debugging a web app in Visual Studio 2013 Express for Web. This app is MVC with angularjs, jquery, bootstrap. I have other web apps that work fine and do not have this error, and I'm not sure where to look to resolve this. I've compared web.configs, global.asax, etc with projects that are working.

I can reproduce this behavior by creating a new Web Project, and select MVC. When I debug this new project I get the same error.

XMLHttpRequest cannot load http://ssl.socialprivacy.org/native/pagehandler.php. 
The 'Access-Control-Allow-Origin' header has a value 'http://localhost' 
that is not equal to the supplied origin. Origin 'http://localhost:54400' 
is therefore not allowed access. 

I've seen the other question here but it does not solve my problem. Access-Control-Allow-Origin error

Community
  • 1
  • 1
Ryan Langton
  • 6,294
  • 15
  • 53
  • 103

1 Answers1

1

Because you are trying a cross domain ajax call. Browser will block it because of same origin policy. If you are trying to make cross domain ajax, you should CORS in your ajax. Server should also enabled it. Another method for cross domain ajax is using jsonp.

Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53