Passing parameters from PHP to Javascripts in plugins » Otto on WordPress

Much cleaner. One static and unchanging JS file to cache. Parameters get put into your HTML itself as a one-liner. You can deal with the parameters using a normal PHP array before passing them over. No need to screw around with generating Javascript from PHP or looking for wp-load or even messing with tricky actions.

via Passing parameters from PHP to Javascripts in plugins » Otto on WordPress.

  • http://www.evilripper.net/ evilripper

    thanks! I can’t find a solution to this problem…  wp_localize_script is created to translate javascript… but this is a good solution! :-)