简体   繁体   中英

display content of a URL in a div

I am opening a popup window in the following format :

window.open('http://URL', 'invitationwindow', 'height=250,width=500,scrollbars=yes,resizable=yes,status=yes')

How I do I Get the content of the popup in a div in the same page. I mean, I don't want the popup but the content of it should be displayed in the same page from where the popup is fired.

How can this be done using Jquery? I know .append() and .html() will add content to div, but in this case I am getting content from the URL like http://example.com .

Thanks!

使用jquery load()

$('#mydiv').load('http://URL');

通常人们会使用<iframe>

Using jquery, use this:

$.get('ajax/test.html', function(data) {
  $('.result').html(data);
  alert('Load was performed.');
});

and

$('#result').load('ajax/test.html', function() {
  alert('Load was performed.');
});

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM