 <p>There is no option to directly assign php variables to javascript. To do this you need to assign assign it to html elements like,</p> <pre><code>&lt;input type="hidden" id ="amazon" value="&lt;?php echo $is_amazon; ?&gt;"&gt; </code></pre> <p>We can get the value in jquery from this html element by using this code,</p> <pre><code>var amazon = $('#amazon').val(); </code></pre> <p>For security reasons the php variables cant assign to javascript variables. </p>