2012-06-11 18 views
0
導航頁面

我遇到問題不顯示。我有一個調查表,在這種形式中,我也用ajax來調用一些數據。當用戶單擊取消時,我希望它導航到其他頁面,它使用ajax顯示列表視圖中的數據列表。對於點擊和導航部分,我已經成功將其帶到我想要的頁面,但問題是,現在不顯示數據的列表。我使用了與其他頁面相同的方式,但爲此我無法獲得任何幫助?我已經通過我的代碼幾次,但我不明白是什麼讓它錯了。這是我的頁碼調查表的代碼:數據後

$('#MrateCourse').live('pageinit', function(){ 

    var rowInput = "1"; 
    var pageInput = "1"; 
    var idInput = "${courseId}"; 
    var regNoInput = "${regNo}"; 

    $.ajax({ 
     url: '${pageContext.request.contextPath}/getRegisteredClassesDetails.html', 
     data: ({rows: rowInput, page: pageInput, courseId: idInput, regNo: regNoInput}), 
     type: 'POST', 
     success: function(json_results){ 
      $('#list').append('<ul></ul>'); 
      listItems = $('#list').find('ul'); 
      $.each(json_results.rows, function(courseId) { 
      html = ' Course Name : 
        + '<b>' + json_results.rows[courseId].courseName + '</b>'; 
      html += '</br> Registered Person : 
        + '<b>' + json_results.rows[courseId].fullName + '</b>'; 

      listItems.append(html); 
      }); 

      $('#list ul').listview(); 
     } 
    }); 
}); 

$(function() { 
    var currentTime = new Date(); 
    var month = currentTime.getMonth() + 1; 
    var day = currentTime.getDate(); 
    var year = currentTime.getFullYear(); 

    if(day<10){ 
     day='0'+day; 
    } 
    if(month<10){ 
     month='0'+month; 
    } 

    var currentTime = new Date(); 
    var hours = currentTime.getHours(); 
    var minutes = currentTime.getMinutes(); 

    var suffix = "AM"; 
    if (hours >= 12) { 
    suffix = "PM"; 
    hours = hours - 12; 
    } 
    if (hours == 0) { 
    hours = 12; 
    } 

    if (minutes < 10) 
    minutes = "0" + minutes; 

    $('#dateTime').html("<b>" + month + "/" + day + "/" + year + " " + hours + ":" + minutes + " " + suffix + "</b>"); 
}); 


    <form id="" action="${pageContext.request.contextPath}/MRegisteredClasses.phone" method="POST"> 
    <table> 
      <tr> 
       <td>Date: 
        <span id="dateTime"></span><br/></td> 
      </tr> 
      <tr> 
       <td>Company:</td> 
       <td><input type="text" value=""/><br/></td> 
      </tr> 
      <tr> 
       <td><b>Based on your experience in this course, please answer<br>the following questions: 
       <br>1 = Strongly Disagree, 5 = Strongly Agree</b></td> 
      </tr> 
      <tr> 
       <td>The web-based training media used was of high quality.</td> 
       <td><select> 
         <option value=""></option> 
         <option value="5">5</option> 
         <option value="5">4</option> 
         <option value="3">3</option> 
         <option value="2">2</option> 
         <option value="1">1</option> 
        </select><br/></td> 
      </tr> 
      <tr> 
       <td>I had enough time to learn the subject matter covered in the course.</td> 
       <td><select> 
         <option value=""></option> 
         <option value="5">5</option> 
         <option value="5">4</option> 
         <option value="3">3</option> 
         <option value="2">2</option> 
         <option value="1">1</option> 
        </select><br/></td> 
      </tr> 
      <tr> 
       <td>My knowledge and/or skills increased as a result of this course.</td> 
       <td><select> 
         <option value=""></option> 
         <option value="5">5</option> 
         <option value="5">4</option> 
         <option value="3">3</option> 
         <option value="2">2</option> 
         <option value="1">1</option> 
        </select><br/></td> 
      </tr> 
      <tr> 
       <td>Additional comments or ideas to improve this course:</td> 
      </tr> 
      <tr> 
       <td><textarea rows="3" ></textarea></td> 
      </tr> 
      <tr> 
       <td>What additional topics would you like to see addressed in a future online course?</td> 
      </tr> 
      <tr> 
       <td><textarea rows="3"></textarea></td> 
      </tr> 
      <tr> 
       <td align="left"> 
        <input type="submit" data-inline="true" id="submit" value="Submit This Survey" class="ui-btn-right" 
         onClick="confirm('Thanks for filling the survey')"/> 
        <a href="${pageContext.request.contextPath}/MRegisteredClasses.phone" class="ui-btn-right" 
         data-role="button" data-inline="true">Cancel</a> 
       </td> 
      </tr> 
    </table> 
    </form> 

這是我需要瀏覽的頁面的代碼。

<div data-role="page" id="MregisteredClasses"> 
<div data-role="content"> 
    <h3>Courses Name</h3> 
    <p id="note">*Click at the courses to view the details</p> 
    <h1></h1> 
    <div id="courseName"> 
     <ul data-role="listview" data-inset="true" id="list"></ul> 
     <script type="text/javascript"> 
      $('#MregisteredClasses').on('pageinit', function(){ 
       var rowInput = "1"; 
       var pageInput = "1"; 

       $.ajax({ 
       url: '${pageContext.request.contextPath}/getRegisteredClassesData.html', 
       data: ({rows : rowInput , page : pageInput}), 
       type: 'POST', 

       success: function(json_results){ 
        $('#list').append('<ul data-role="listview" data-inset="true" data-split-icon="gear"</ul>'); 
        listItems = $('#list').find('ul'); 
        $.each(json_results.rows, function(key) { 
         html = '<li <h3><a href="${pageContext.request.contextPath}/MRegisteredClassesDetail.phone?courseId=' 
          + [json_results.rows[key].courseId] + '&regNo=' + [json_results.rows[key].regNo] + 
          '"rel="external">' + json_results.rows[key].courseName+ '</a></h3>' 
          + '<a href="${pageContext.request.contextPath}/MRateCourse.phone?courseId=' 
          + [json_results.rows[key].courseId] + '&regNo=' + [json_results.rows[key].regNo] + 
          '"rel="external">RATE THIS COURSE</a>'; 
        listItems.append(html); 
        }); 

       $('#list ul').listview(); 
       }, 
      }); 
      }); 
     </script> 
    </div> 
</div><!-- /content --> 
+0

使用jQuery結合,而不是 –

回答

0

我已經知道了..我將data-ajax="false"添加到我的表單中。

+0

接受的答案呢:) –

+0

你,我要接受的答案,但需要5個多小時之前,我能接受 – sone