如何刷新JQuery Mobile中加载了外部内容的DIV的CSS [英] How do I refresh the CSS for a DIV loaded with external content in JQuery Mobile

查看:116
本文介绍了如何刷新JQuery Mobile中加载了外部内容的DIV的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了您的所有评论,但是我阅读的所有解决方案似乎都无效.我有一段Jquery代码,它从外部PHP脚本获取一些内容,该脚本更新了我的应用程序中的div.加载新数据后,它没有Jquery Mobile样式.我已经看到一些人如何使用.page()或trigger("refresh")等,但是这些都无法刷新整个div.这是我的代码和有问题的html部分:

I have read all of your comments, but none of the solutions I read seem to work. I have a piece of Jquery code that gets some content from an external PHP script which updates a div in my application. After the new data is loaded, it doesn't have the Jquery Mobile styling. I've seen how some have used .page() or trigger("refresh"), etc... but none of that works to refresh an entire div. Here is my code and the portion of html in question:

function getcontent(pg) {
   $("xyz").html("");
   $.get("http://myscript.php", function(data) {
      $("#xyz").html(data);
      $("#xyz").page();
}

HTML:

<div id="xyz"></div>

真的,这没什么可做的,我只是想不通.如果删除包装器div("xyz")并刷新单个元素的列表视图,按钮等,我将获得一定的成功",但这是处理此问题的笨拙方法.

Really, there's not much to this at all and I just can't figure this out. I had "some" success if I removed the wrapper div ("xyz") and just refreshed the individual elements' listview, buttons, etc., but that's a terribly clumsy method of handling this.

推荐答案

尝试使用

$("#page_id").trigger("create")

在其上添加了内容的页面上.

on the page that gets the content added to.

这篇关于如何刷新JQuery Mobile中加载了外部内容的DIV的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆