 <p>Some like that:</p> <pre><code>(function ($) { "use strict"; $(document).ready(function () { if ($.fn.plot) { var dataPie = [{ label: "Samsung", data: &lt;?php echo $data1 ?&gt; }]; } }); }); </code></pre>