Display JSON data

Display JSON data

I have two php files on website, 1 - index.php and 2 - list.php.

A menu link in index.php points to the list.php page. 

The data on list.php is JSON from mysql server. Data can be correctly displayed. So far so good.


Problem: Unless the link specifies data-ajax=“false”, the data does not render until I refresh the list.php page. Not a huge problem, but is there a way to achieve desired result without using data-ajax=“false”?

Here is the javascript:


$(document).on("pagecontainershow",function(){

            var url="Connections/memberConn.php";

            $('.memList').html("");

            $.getJSON(url,function(json){

            $.each(json.members,function(i,dat){

        $('.memList').append("<tr><td><span class='surname'>"+dat.LName+"</span>  "+dat.FName+"</td>"

        +"<td>"+dat.Spouse+"</td>"

        +"<td>"+dat.Street+"<br>"+dat.Town+" "+dat.Postal+"</td>"

        +"<td><a href=tel:+"+dat.Telephone+">"+dat.Telephone+"</a></td>"

        +"<td><a href='mailto:"+dat.E_mail+"?subject=Probus Club'>Email</a></td>"

        +"</tr>");

                }); //each  

                 $(".wrapper").tablesort();

            }); //getjson

           

    });