unable to write javascript inside the php page
<p>i have written a javascript inside the php file, but while calling it from my main page like this </p>

<pre><code>     &lt;script type="text/javascript" src="&lt;?php echo base_url() . 'js/inf-scroll/javascript_showuserinst.php' ?&gt;"&gt; &lt;/script&gt;
</code></pre>

<p><strong>Problem</strong>: if i see in the javascript_showuserinst.php file a line as <code>$.post('/instruction/show_user_inst/&lt;?php echo $userid; ?&gt;', {
</code>  here <code>&lt;?php echo $userid; ?&gt;</code> is giving me problem. Is that line syntax is correct?</p>

<p>I see the <code>view source</code> its showing <code>&lt;b&gt;Notice&lt;/b&gt;:  Undefined variable: userid in &lt;b&gt;D:\xampp\htdocs\js\inf-scroll\javascript_showuserinst.php&lt;/b&gt; on line &lt;b&gt;46&lt;/b&gt;&lt;br /&gt;</code></p>

<p><strong><em>But if i copy &amp; paste the same js content in the main page without calling it from external  file, it works perfectly.</em></strong> </p>

<p>javascript_showuserinst.php
    

<pre><code>Header("content-type: application/javascript");

?&gt;  
(function($) {

        $.fn.scrollPagination = function(options) {

                var settings = { 
                        nop     : 10, // The number of posts per scroll to be loaded
                        offset  : 0, // Initial offset, begins at 0 in this case
                        error   : 'No More Data To Display!', // When the user reaches the end this is the message that is
                                                    // displayed. You can change this if you want. 
                                     .............
                                     .............
</code></pre>
