The proper way to have Javascript call PHP scripts
-
Hello,
I am currently working on a project that requires users to down vote and upvote things, an example being links in a post.
I have all of the voting data saved into custom fields for each post.
Currently when a person down votes or upvotes something I have a Javascript function that makes a xmlhttprequest to a PHP script somewhere on my server.The script loads wordpress functions using
require_once('../../../../wp-load.php');and I update_post_meta or do whatever I have to do.
I am wondering if this is the best way to go about getting this effect and what is the best practice for doing something like this?
Thanks
The topic ‘The proper way to have Javascript call PHP scripts’ is closed to new replies.