这是我正在做的嘲笑:
- function loadPage(pn) {
- $('#'+pn).live('pagecreate',function(event,ui){
- $('#'+pn+'-submit').click( function() {
- $.mobile.changePage({
- url: 'page.PHP?parm=value',type: 'post',data: $('form#'+pn+'_form')
- },'slide',false,false);
- loadAjaxPages(pn);
- });
- });
- function loadAjaxPages(page) {
- // this returns the page I want,all is working
- $.ajax({
- url: 'page.PHP?parm=value',type: 'POST',error : function (){ document.title='error'; },success: function (data) {
- $('#display_'+page+'_page').html(data); // removed .page(),causing page to transition,but if I use .page() I can see the desired listview
- }
- });
- }
在ajax调用返回如果我添加.page()(它在过去工作但我把它放在页面函数的一边,更改了我如何加载页面以节省加载时间的逻辑),使页面转换为下一页,但我可以看到listview的样式符合我的要求:
- $('#display_'+page+'_page').html(data).page();
删除.page()可修复转换错误,但现在页面没有样式.我尝试过listview(‘refresh’)甚至listview(‘refresh’,true),但没有运气.
关于如何让listview刷新的任何想法?
解:
- $.ajax({
- url: 'page.PHP?parm=value',success: function (data) {
- $('#display_'+page+'_page').html(data);
- $("div#name ul").listview(); // add div wrapper w/ name attr to use the refresh
- }
- });