2012-05-07 23 views
1

iはworpressデータから投稿データを選択するアプリをbulidしようとしています。私は底にAJAXをロードするときにエンドjquerymobile Ajaxの問題

<?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> 

にdescribeitいる probalme: はとてもそのすべてただ、これは私のコードであること を示しjqueryの - 機動で<ul>でシンプル<li> elmenetsをする必要がありますページ通常通り<li> elemnetショーとないjqueryのCSSスタイル

答えて

1

を持って、私は同じ問題を抱えていました。 、Ajax呼び出しを行いますの線に沿って何か:

$.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.'); 
    } 
}); 

そしてあなたはAjax呼び出しを介して受信したポストを使用してページを更新するためにJavaScriptでこのコードを使用します。

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

それは私のために問題を解決しました。

多分これは同様にあなたを助けることができる:http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content

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");} 
      }, 

    }); 


}