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