Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a table,which has a field counting the downloaded files,so with php
I can return the value:

<span class="num" id="<?php echo $id;?>">Downloaded:<?php echo
$downloadcount;?></span>

when clicking the button,it will download the file:

<input type = "button" value="Download" class="button" id="<?php echo
$id; ?>" name="dl" onclick="window.location.href='<?php echo
$track;?>'">

I wanted to refresh the download count when clicking the button first is it
possible?because I think by using onclick in the span section I can't have
an onclick event in jquery but if I will assume that it is possible then
how to store it in php?so I can update the table?

I wrote something which is wrong:

$(function() {
    $(".button").click(function(){
    var clicks = 0;
    var theID = $('.num').attr('id');

    clicks++;
    $(theID).html("Downloded:"+clicks);
 });
});

in php section I have a while loop that will return each row like this:

while($row=mysql_fetch_array($sql))
{
    $id=$row['ID'];
//some code

}

here is my demo if you would like to see the whole enter  james in textbox:

http://parsa-web.goodluckwith.us/index.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux