@phpmypython – He didn’t mean for localization. He meant for actually defining the variables you need in javascript. That’s the other (purposed) reason of wp_localize_script.
In other words, in gravityform-placeholder-addon.php:
add_action('wp_enqueue_scripts', 'gf_placeholder_addon_script_enqueue');
function gf_placeholder_addon_script_enqueue() {
$placeholder_js = plugins_url( basename(dirname(__FILE__)) ).'"/jquery.placeholder-1.0.1.js';
wp_enqueue_script('gf_placeholder_add_on', $plugin_url . '/gfplaceholderaddon.js', array('jquery'), '1.0' );
wp_localize_script('gf_placeholder_add_on', 'gf_placeholder_vars', array('jquery_placeholder_url' => $placeholder_js) );
}
In your gfplaceholderaddon.js:
if ( support && gf_placeholder_vars.jquery_placeholder_url )
$.ajax({
cache: true,
dataType: 'script',
url: gf_placeholder_vars.jquery_placeholder_url,
success: function() {
$('input[placeholder], textarea[placeholder]').placeholder({
blankSubmit: true
});
},
type: 'get'
});
I made a couple of edits after my initial post, so make sure you don’t rely on the initial notification of my post for accurate advice.