using jquery (json) to get ajax database entries in wordpress - PHP not working -


I am writing a plugin for my WordPress site and I'm having trouble understanding jquery ajax requests. In short, I am trying to load some user meta data when the page is loading.

So I have a line in my javascript file:

  $ GetJSON ("http://mysite.co.uk/wp-content/plugins/myplugin/ Ajax / Ajax .php? Action = test", function (jsn) {// do stuff});  

So called above, but this is the PHP code in which I have problems. In the file ajax.php, I am calling a database, but none of the general category information is available. I have tried to include the Admin Ajax page, various other pages of your own plugin (which works) ... not sure what else to do!

The database call method works fine in my plugin code .. but I think the AJAX.php file is outside the WP framework and that's why it's not working ... but I do not know how Get it in the framework!

To get me your SQL, go to $ wpdb-> The need to use get_results ($ sql) command. The error from firebug is that i am calling an undefined function.

Thanks for any help ...

Read it, basically You only need to define callback for an action and use the previously defined WordPress system.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -