$params = array ( "imageurl" => plugins_url('images/', __FILE__), "post_id" => get_the_id(), ); wp_localize_script( 'myScript', 'myparams', $params );
The localisation needs to be called after the script is enqueued. This is useful method to pass static option data through.
However it doesn’t work if you need data from the wordpress loop after the </head> tag is closed
so you need to use this style