Postman extension gets response, but my jquery request is not

I make a GET request using the Postman extension and get a response, but if I make the same request using jQuery, I get a typical error:

XMLHttpRequest cannot load http://www.rfen.es/publicacion/ranking/resultsBySwimmer.asp?l=020039535&t=&p=0&e=50L-I . There is no "Access-Control-Allow-Origin" header in the requested resource.

Why is this happening?

My javascript code is simple:

function getTiempo (dni, piscina, prueba) { $.ajax({ async: false, type: "GET", url: "http://www.rfen.es/publicacion/ranking/resultsBySwimmer.asp?l="+dni+"&t=&p="+piscina+"&e="+prueba }) .done(function (data) { console.log(data); return data; }); } 

The Postman extension is also not in the same domain, why is it receiving a response?

+5
source share
1 answer

Just to help future young people find this specific question: Why does POSTMAN work and my jQuery does not work!

The answer is pretty simple, actually: Chrome Extensions is allowed to do this!

Regular web pages can use the XMLHttpRequest object to send and receive data from remote servers, but they are limited by the same origin policy. Extensions are not so limited. An extension can talk to remote servers outside its origin if it first requests cross-origin permissions.

https://developer.chrome.com/extensions/xhr

+6
source

Source: https://habr.com/ru/post/1200247/


All Articles