jquery 移动加载外部页面到 div
jquery mobile load page external into div
如何在 div
成功完成我的调用 ajax
时插入 register.html 页面的外部代码?
function onSuccess(data, status)
{
$.mobile.pageContainer = $("#content").pagecontainer();
$.mobile.pageContainer.pagecontainer("load", "register.html");
}
function onError(data, status)
{
// handle an error
}
我使用 pageContainer
但没有在 #content div
中加载 html
如果使用 JQuery,您可以使用加载方法加载外部 pages/markup。这将允许您将其输出到 div.
$( "#result" ).load( "ajax/test.html" );
有关详细信息,请参阅
您需要使用 enhanceWithin() 否则 JQuery 将不会对新内容执行移动增强:
$.get('pagename.html', function (response) {
$('#result').html(response).enhanceWithin();
});
如何在 div
成功完成我的调用 ajax
时插入 register.html 页面的外部代码?
function onSuccess(data, status)
{
$.mobile.pageContainer = $("#content").pagecontainer();
$.mobile.pageContainer.pagecontainer("load", "register.html");
}
function onError(data, status)
{
// handle an error
}
我使用 pageContainer
但没有在 #content div
如果使用 JQuery,您可以使用加载方法加载外部 pages/markup。这将允许您将其输出到 div.
$( "#result" ).load( "ajax/test.html" );
有关详细信息,请参阅
您需要使用 enhanceWithin() 否则 JQuery 将不会对新内容执行移动增强:
$.get('pagename.html', function (response) {
$('#result').html(response).enhanceWithin();
});