I am creating an AJAX application to query an OData endpoint. I tested the Netflix OData feed and found what I am not getting:
When I make a .ajax () request for a URL (e.g. http://odata.netflix.com/v1/Catalog/Titles ), I get an error: "Origin null is not allowed through Access-Control-Allow- Origin. " However, when I put the same url in my browser, the request goes through and I get a response.
What is the fundamental difference here that I am not getting? How does a browser bypass a policy of the same origin?
JSONP Oflata Netflix. , . http://bit.ly/95HXLM
:
49. // Make JSONP call to Netflix 50. $.ajax({ 51. dataType: "jsonp", 52. url: query, 53. jsonpCallback: "callback", 54. success: callback 55. }); 56. }); 57. 58. function callback(result) { 59. // unwrap result 60. var movies = result.d.results; 61. 62. $("#movieTemplateContainer").empty(); 63. $("#movieTemplate").tmpl(movies).appendTo("#movieTemplateContainer"); 64. }
HTTP-, , . , , , , haxors.r.us, , HTTP- bankofamerica.com . , , HTTP- . , , . !
URL , ( - , ). Netflix API JSONP, GET script, Javascript.
, jQuery. XMLHttpRequest.
Source: https://habr.com/ru/post/1772703/More articles:Xml representation of expected result for Junit test - javasql select using mysql query browser - sqlWhy does the handler not trigger a warning as expected? - androidOn Chrome ajax async postback end not working - google-chromejquery $.ajax() и его обратный вызов успеха - куда он возвращается? - javascriptHow can I programmatically change KeyView ListView in my collection? - .netHow to eliminate "www". at the beginning of the urls on the server? - urlHow to call back button from Flex application with deep binding - flexудалить 'WWW' в ASP.NET MVC 1.0 - urlReplace & not at the end of the line and do not precede \ with \ & in Vim - vimAll Articles