Load child from external page

2019-08-31 05:06发布

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');

});

标签: jquery load
2条回答
爷、活的狠高调
2楼-- · 2019-08-31 06:04

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 });
查看更多
叼着烟拽天下
3楼-- · 2019-08-31 06:13

I've found that this works.

$('#product_name').load('http://cdn.jeremyblaze.com/theme_info.html #' + product_name + ' #product_name_source');
查看更多
登录 后发表回答