I'm new to Ajax. I tried to use the AJAX method for Google Image Search (Deprecated API) for some reasons my client is liking the deprecated API compared to custom search. When I make a request then it says that
blocked cross-origin request: Remote processing at the same basic policy at https://ajax.googleapis.com/ajax/services/search/images Does not allow reading? V = 1.0 & amp; RSZ = 8 & amp; Start = 0 & amp; Imgsz = xlarge, large & amp; Q = apple It can be fixed by transferring resources to a single domain or enabling the Corus
But when I call it through the browser URL, it responds with the correct response .
My AJAX request
$ Ajax ({Type: "GET", url: "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&start=0&imgsz=xlarge, LFCA ., Preceded: function {xhr.setRequestHeader ('referer', 'http://www.mydomainexample.com')}}, success: function (result) {console.log (result)}, error: function {Error} {console.log (error)}})
Please excuse me for any mistake. Please help me.
Ah, the source of such a strange insect,
What is actually a preflight option under the hood? This is the original domain that contains the original header and the protocol that you are currently in. The server gives a group of CORS headers (access-control-permission-origin and co), which then tells the browser to request them Should be allowed to go along.
If the original and the CORS header do not match, then it throws the error encountered by you. There is no way around it in the browser, if you You APIs must proxy if you want to work it Stw.
No comments:
Post a Comment