To load a HTML page from a different domain using jQuery AJAX, you need to use JSONP (JSON with Padding) which is a technique for loading data asynchronously from a different domain using a script tag instead of XHR. Here's an example code:
$.ajax({
url: "http://example.com/page.html",
dataType: "jsonp",
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.log(error);
}
});
Note that the server you are loading the HTML from must support JSONP by wrapping the response in a callback function.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-10 18:40:46 +0000
Seen: 7 times
Last updated: Jun 10 '23
What is the method for altering the color of the input text in a TextFormField in Flutter?
What is the procedure for utilizing the node-rdpjs library?
What is the method to change a PDF file to an Excel file using C#?
What is the method to make a TextButton inactive when the text field has no text?
What is the method to alter the background image in HTML?
What is the method for saving an entity with @EmbeddedId as its primary key in Hibernate?
What is the method to superimpose two seaborn density plots?