Jquerymobile - Pagination - Listview - page loads endlessly
===

i am doing a pagination on a list
and the page loads fine, but when i try to access this page from another page it loads endlessly and the page is not loaded

if i remove the $("#allcomments").trigger( "create" );
then the page is loaded from another page

the same if i use                 	$('#mylistview').listview(); 
ins tea of trigger create


thanks
 
        <?php include ('head.php') ?>
        <body>

    <div id="allcomments" data-role="page" data-add-back-btn="true">

        <?php include ('header.php') ?>
        <?php include ('connectDB.php') ?>

        <div data-role="content">

                <h4>Alle Kommentare</h4>

	        <script type="text/javascript">


		<?php

               	$id= mysql_real_escape_string($_GET['id']);
      
		$comment_sql =  *** some SQL ****
		$comment_query = mysql_query($comment_sql) or die("Anfrage nicht erfolgreich");
				
		$user_sql = ***some SQL***
		$user_query = mysql_query($user_sql) or die("Anfrage nicht erfolgreich");
			
		$userarray = array();
				
		while ($userrow = mysql_fetch_array($user_query)) {

			$userarray[$userrow["ID"]] = $userrow["USERNAME"];	

		}

		echo 'var members = [';

        		while ($commentrow = mysql_fetch_array($comment_query)) {
							
				echo "['";
				echo  date("Y-m-d", strtotime($commentrow["TIMESTAMP"]));
				echo '  >>>  ';
				echo $userarray[$commentrow["USER"]];
				echo "', 'Bewertung:  ";
				echo $commentrow["RATING"];
				echo "', '";
				echo $commentrow["TEXT"];
				echo "'],"; 

			}

		echo '];';

				
		?>

        	function pageselectCallback(page_index, jq){
                
	                var items_per_page = 5;
        	        var max_elem = Math.min((page_index+1) * items_per_page, members.length);
                	var newcontent = '';

			newcontent += '<ul data-role="listview" id="mylistview" data-inset="true" >';
                
                	for(var i=page_index*items_per_page;i<max_elem;i++) {
			
	                    	newcontent += '<li></br><p style="font-size:12px;font-weight:normal;display:block;margin:-.5em 0 .6em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap"><b>';
                    		newcontent += members[i][0];
		    		newcontent += '</br>';
                   	 	newcontent += members[i][1];
		    		newcontent += '</br></b>';
		    		newcontent += '</br>';
                    		newcontent += members[i][2];
                    		newcontent += '</p></li>';
           
	     		}

			newcontent += '</ul>';

                	$('#mylistview').html(newcontent);
			$("#allcomments").trigger( "create" );

            
		}
	

            	$(document).ready(function(){
                
                	var opt = {callback: pageselectCallback};
                	$("#Pagination").pagination(members.length, opt);
             
		});

		</script>

		<a href="comment.php?id=<?php echo $id; ?>" data-transition="flip"  data-role="button" data-theme="b" data-icon="arrow-r">Kommentar abgeben</a>
		</br>
            	<div id="Pagination" class="pagination" align="center"></div>          
            	<ul data-role="listview" id="mylistview" data-inset="true" >
                	Content will be inserted here ...
            	</ul>
	    </div>
    </div>
    </body>
    </html>
