Load child from external page

2019-08-31 05:29发布

问题:

Can someone help me edit this jQuery so that instead of pulling the #product_name_source from anywhere on the page it takes it from within the #Altitude div. As you can see, I've tried something there but it seems that you can't have multiple divs in a URL http://google.com #parent #child. Anyone able to help?

$('body').ready(function(){

    var product_name = 'Altitude';

    $('#product_name').load('http://cdn.jeremyblaze.com/theme_info.html #' + product_name + '#product_name_source');

});

回答1:

Try this

$('body').ready(function(){
var product_name = 'Altitude';

$('#product_name').load('http://cdn.jeremyblaze.com/theme_info.html' +'#product_name_source', {pName:product_name });


回答2:

I've found that this works.

$('#product_name').load('http://cdn.jeremyblaze.com/theme_info.html #' + product_name + ' #product_name_source');


标签: jquery load