Reputation: 591
I am trying to load another Url into div tag using jquery on click function. But it loads the same page into the div tag.
Below is my code:
Jquery:
function loadPage() {
$('#xterm').load('http://google.com',function () {
alert('Page Loaded');
});
}
HTML:
button:
<button class="btn btn-primary Border" type="button" onclick="loadPage()">
div:
<div class="ScrollStyles1" id="xterm"> </div>
Upvotes: 0
Views: 1114
Reputation: 164
Your code is working well but browser ignores it due to security reason. Please run your code and check console here is the console error
for this you need to do is The URL to be loaded must either be on the same domain as the page that's calling it, or enable cross-origin HTTP requests.
You should download extension for Access-Control-Allow-Origin:* in browser to see the effects.
Upvotes: 3