Tuesday, 15 November 2016

angularJS ajax call fails 403 but jQuery ajax call works for cross-site templateUrl loading.

To test AngularJS, I took the following code is right from the "Wire up a Backend" example off the http://angularjs.org/ home page. When the views are local everything works as expected but when I move the views to another URL I get a 403. See the jsbin example here:



http://jsbin.com/olavok/1/edit



OPTIONS ... 403 (Forbidden) angular.min.js:99
XMLHttpRequest cannot load .... Origin http://jsbin.com is not allowed by Access-Control-Allow-Origin.



However, jQuery works just fine. Right in the same jsbin I added a jQuery ajax call and we see JQUERY SUCCESS in the logs. If you look at the result you see jQuery delivered the view.




Any thoughts on how to get Angular to play nice cross site? I read that angular is using "jQuery light" for DOM. Is there a way to get angular to fall-back and use jQuery for ajax?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...