1

我试图构建一个从工作数据中选择帖子数据的应用程序。所以它只需要在 jquery-moblie 中成为一个简单的<li>elmenets<ul>来显示这是我的代码:probalme 最后有描述它

<?php /**
        * @author yosef yawitz
        * @copyright 2012
        * @name index.php
        **/
require_once 'inc/header.php';
/**
 * $query = 'inventory_sku';
 * $a = wareHouseAllItems($query);
 */
?>
<script src="js/jqm.autoComplete-1.3.js"></script>
<body>
<div data-role="page" id="indexPage">

    <div data-role="header" data-position="fixed"> 
        <h1> בר דעת </h1> 
    </div>
    <div data-role="content">
    <ul id="inventoryProducts"data-role="listview" data-theme="g">
        </ul>
    </div>
    <div data-role="footer">
        <h1>Comp</h1>
    </div>
</div>
<script>

        $(document).ready(function(){
        $('#inventoryProducts').load('inc/load_posts.php');
        });
 </script>
</body>
</html>

当我在页面底部加载 ajax 时,<li>elemnet 显示正常并且没有 jquery css 样式

4

2 回答 2

1

I had the same problem. Do an Ajax call, something along the lines of:

$.ajax({
    type: 'POST',
    url: inc/load_posts.php,
    success:function(receivedData){
        // successful request; do something with the data
        var myData = receivedData;
        },
    error:function(){
        // failed request; give feedback to user
        alert('Ajax call failed.');
    }
});

And then use this code in Javascript to update your page with the posts you received through the Ajax call.

$("#content").html(myData).page();
$("#content").page("destroy").page();

It solved the problem for me.

Maybe this can help you as well : http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content

于 2012-05-14T14:43:51.297 回答
0
function loginfunction()
{ 

  alert(1);

    var uname=document.getElementById('uid').value;
    var pword=document.getElementById('psw').value;
    var query="UID="+uname+"&PWD="+pword;

    alert(2);

    $.ajax({
        url:"http://192.168.1.36/login.php",
        type:"POST",
        data:query,
        timeout:10000,
        success : function(data)
        { 
            alert(3);

            data=jQuery.parseJSON(data);
            if(data==1){alert("success");
            window.location='Home.html';}
            else if(data==0){alert("fail");}
            },

    });


}
于 2015-09-15T04:33:22.130 回答