You can pass dynamic values and data to jquery/javascript using the wp_localize_script() function.
Enque your custom javascript file with wp_enqueue_script() function, then localize it with ur values like below.
function cp_script() {
//$params are the parameter array
$params = array(
'url' => get_permalink(116),
'variable' => $value
);
wp_enqueue_script( 'my-custom-script', get_bloginfo('stylesheet_directory') . '/js/my-custom-script.js', array( 'jquery' ) );
wp_localize_script( 'my-custom-script', 'CpParams', $params );
}
add_action( 'wp_enqueue_scripts', 'cp_script' );
Then in your js file, ie in my-custom-script.js you can get the values like below
Myurl = CpParams.url; myVar= CpParams.variable; alert(Myurl); alert(myVar);




