• Register
0 votes

Problem :

I am getting following error
cross-origin request blocked: the same origin policy disallows reading the remote resource at
6.9k points

1 Answer

0 votes

Solution :

Please note the JSONP or "JSON with padding" is a communication technique used in JavaScript programs which are running in web browsers to request data from a server which is in a different domain, something got  prohibited by the typical web browsers because of the same-origin policy. Also JSONP takes advantage of the fact that browsers are not enforcing the same-origin policy on script tags. So for JSONP to work, a server must know how to reply with JSONP-formatted results. Please note JSONP does not work with JSON-formatted results.

        type: "GET",
        url: 'http://www.oxfordlearnersdictionaries.com/search/english/direct/',
        dataType : 'jsonp',   //you can use jsonp for cross origin request
        success: function(data, status, xhr) {

Further Readings :

36.1k points

Related questions

0 votes
2 answers 673 views
Problem : Uncaught domexception: blocked a frame with origin from accessing a cross-origin frame:I am trying to load the <iframe> in my HTML page and want to access the elements within it using the Javascript, however when I want to execute my code, I face the below ... || iframe.contentWindow.document; var mytarget = mydoc.getElementById("my-target-id"); mytarget.innerHTML = "Found it!"; }); });
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 171 views
Problem : I have spent over the 10 hours in finding the exception or the special character to find in the code but I am unable to find it. I have already checked every similar messages in here. I am facing below error: Syntaxerror: json.parse: unexpected character at line 1 ... my form after that I am sending all the inputs to the main.js to validate it. So, I am just looking for the third-eye.
asked Dec 23, 2019 alecxe 7.5k points
0 votes
1 answer 3 views
Problem: I am very new to programming world. I have below HTML code and I want to submit it and save the form data with the help of javascript. <!DOCTYPE html> <html> <head>   <meta charset="utf-8">   <meta name="viewport" content="width=device-width"> ... If I click on the submit button then the above forms data should be saved somewhere for the each and every user who fills and submits the data.
asked Jul 30 Raphael Pacheco 2.6k points
1 vote
1 answer 73 views
Problem : I am very beginner to PHP, Jquery and ajax, and I am really going through very hard time while trying to find a solution on a web based platforms which I could use to solve my problem. Currently I am trying to display the data from my database into ... for me also tried to find for the solution online but unable to find any. So looking for expert programmers help who can fix my problem.
asked May 18 Martin K 6.6k points
1 vote
1 answer 38 views
Problem : I keep on facing the below 403 error while performing the AJAX call to the API. &ldquo;403 forbidden: the server understood the request, but is refusing to fulfill it.&rdquo; Above error occurs usually in Microsoft Edge, but does not come up in IE, ... browsers and also the response/request headers match to one another - So is it the case that the POST request is sending the incorrect?
asked Jan 2 alecxe 7.5k points