0

I am making a wordpress plugin. I am having trouble finding documentation on how to get values from a mysql database into a javascript in wordpress. I have seen examples when people are not using wordpress software, but i'm not sure if there is a better way or a need for better security because it is wordpress.

could anyone post a link to a helpful article or show a example?

1 Answer 1

1

You can use JSON to construct data representation in Javascript.

For that, I suggest you use a intermediary PHP page to control ACLs (i.e. restrict unauthorized access) and construct the JSON data/array.

A simple way to take MySQL data to JSON in PHP: JSON encode MySQL results

More PHP JSON documentation here: http://php.net/manual/en/book.json.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.