wordpress get data from custom table call to ajax error

I am trying to get data from custom table when button click with jquery and ajax but i got error
how to solve this.

Fatal error: Call to a member function get_results() on a non-object
in C:xampphtdocsgetwpwp-contentpluginsgetwp_Pdisplay.php on
line 3

Read More

My jquery is here

$(document).ready(function() {

$("#display").click(function() {          
  $.ajax({    //create an ajax request to load_page.php
    type: "GET",
    url: "display.php",                   
    dataType: "html",   //expect html to be returned                
    success: function(response){                    
        $("#responsecontainer").html(response); 
        //alert(response);
    }

}); }); });

display.php is here

get_results(“SELECT * from
`wp_school_post`”);
echo “”; echo “ID”; foreach ($rows as $row )
{ echo
“”; echo “$row->postid”; echo “”;
}
echo
“”; ?>

html button

<input type="button" id="display" class="button" value="Fetch All Data" onClick="fetch_data();" /> 

<div id="responsecontainer" align="center">

any solution

Related posts

Leave a Reply

1 comment