Secondary php plugin file isn't connected to the database
-
I’m working on a plugin that uses AJAX to look up a user-inputted value (via a dropdown form) in the plugin DB table, and the plugin then returns the corresponding output from that database on the same page. The approximate logic goes like this:
– functions.php generates a shortcode
– this shortcode calls the ajax.js script in the plugin folder
– ajax.js sends the user-inputted data via GET to processing.php in the plugin folder
– processing.php returns the responseText and it gets inserted into my results divMy problem: processing.php isn’t connected to the WP database. I’ve tested that every other step in this chain is working by connecting the file manually to the WP database, but obviously that’s not workable for a universal plugin. How do I go about getting WP to recognize processing.php, or else include something in processing.php that generates the necessary database connection?
This is my first time dabbling with anything plugin related, I’d appreciate any tips in the right direction!
- The topic ‘Secondary php plugin file isn't connected to the database’ is closed to new replies.