Now parse Client side json with Wordpress

Jotted by brajesh on January 21, 2010

If you are using wordpress 2.9+ , It is just so easy. You don’t have to worry about the evil thing called “eval” and you don’t have to worry about including JSON javascript parser with your theme/plugin.

Wordpress 2.9+ contains the json2.js from json.org.

So, just put a line in your plugin


wp_enqueue_script("json2");//must be put inside some function called at wp_print_script

Or here is the complete code, how to enqueue the script.


add_action("wp_print_scripts","load_my_script");

function load_my_script(){

//en queue JSON2.js

wp_enqueue_script("json2");

}

and boy! wordpress will load the JSON parser, Now you are ready to use the JSON parser.

Here is more details about what you can do with the JSON parser

http://www.json.org/js.html

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]
If you enjoyed this post, make sure you subscribe to my RSS feed!
Grab my other free plugins here at wordpress Plugins repository.
We will keep coming with more informative tips,tricks,tutorials to keep you updated with wordpress/buddypress/wordpress mu regularly.If you want to help us,You can ,by spreading the words.We provide free and premium plugins/support for wordpress Mu,buddypress at a very low cost (starting with $30 for 3 months membership).If you or anyone you know,needs some real good plugins/themes for their wordpress Mu/buddypress powered site, Please refer them to http://BuddyDev.com.We will highly appreciate your support and keep coming with more useful and free stuffs.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.



Leave a Reply


Get Adobe Flash playerPlugin by wpburn.com wordpress themes