php - Refreshing a particular <span>'s content using ajax? -
i developing web app has messages. in menu, have displayed message number follows.
<ul class="menu"> <li>messages <span id="count" class="pull-right">3</span></li> </ul>
on other hand have php file outputs message count. want update span#count
using php file on click of button class .jm-msg
i have jquery loaded on page. new ajax , javascript, have absolutely no clue on how this. can please guide me providing sample code?
this pretty easy:
setinterval(function(){ $.post("yoururl", function(resp){ $("yourspanid").html(resp); }); }, 1000)
your url needs set file load data from
if want keep span data uptodate use setinterval().
you should use setinterval on whole $.post not function
Comments
Post a Comment