• I am trying to set up where when a user clicks on a button, they will create a new row in a table in the database without refreshing the page using jQuery and AJAX. I am using the following as an example:

    https://www.9lessons.info/2009/04/submit-form-jquery-and-ajax.html

    My main question is this: How can I still use $wpdb format in my “external” .php file that is called by AJAX (stored in the same location as the custom page template that calls it). Do I have to include or require something? Everything works except the updating of the database. Any help would be great please!

  • The topic ‘Does $wpdb work outside of the template page file?’ is closed to new replies.