tow*_*owc 3 html javascript ajax jquery web
有没有办法将javascript变量设置为另一个HTML页面的内容?
我试过了:
var X = $(http://www.website.com/home).html()
但它没有返回任何东西......即使它解释了这个想法......所以...有人能告诉我怎么做吗?也是某个id或class在该网站中的内容,例如:
var X=$(http://www.website.com/home "#id").html()
这对我很有帮助,在此先感谢!
听起来你正在寻找这个:
$.get('otherPage.html').then(function(responseData) {
//responseData is the contents of the other page. Do whatever you want with it.
$('#someElem').append(responseData);
});
Run Code Online (Sandbox Code Playgroud)
$.get()是jQuery的简写方法$.ajax().http://api.jquery.com/jquery.ajax/
| 归档时间: |
|
| 查看次数: |
18057 次 |
| 最近记录: |