Can I do this? $("msgcntDiv").data("newMessageCnt.php");
<p>I have a variable in a span tag:</p>

<pre><code> echo "&lt;span class='headings_sub' id='msgcntDiv'&gt;You have ".$numOfMessages." &lt;/span&gt;";
</code></pre>

<p>My script:</p>

<pre><code> &lt;script&gt;
    $(document).ready(function() {
         var reload = function(){  
       $("msgcntDiv").load("newMessageCnt.php");
    }
    window.setInterval(function() {
        $("#msgcntDiv").load(reload);
    }, 10000);
     });   
&lt;/script&gt;   
</code></pre>

<p>"newMessageCnt.php" has one line:</p>

<pre><code>&lt;?php
include('header_application.php');
$pageValue = "dashboard";
$obj_clean-&gt;check_user();
echo $numOfMessages = $obj_clean-&gt;getUnopenedMessagesCount($_SESSION['user_id']);    
?&gt;
</code></pre>
