In WordPress , sometimes you need to use your PHP variable into included javascript file. You can use below function for this.
wp_register_script( 'myscript', FB_LIKE_PLUGIN_URL . 'fb.js' , array('jquery'), '2.5.4.6' ); wp_enqueue_script( 'myscript' ); $local_variables = array('app_id' => $app_id,'name' => "Milap"); wp_localize_script( 'myscript', 'vars', $local_variables );
wp_register_script function include my own created javascript file from plugin directory and also include jquery file.
$local_variables contains array in which you have to pass all variables with key which you want to access into your fb.js file.
wp_localize_script function will pass this array into js file & you can access theses variables in javascript file like vars.app_id and vars.name !!
Let me know , if you have any confusion ..