Re: 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]

 



Thanks Tedd,

ajax works fine now,when submiting a button it will show the number and it
doesn't have any problem


$(function() {

 $(".button").click(function(){
 var id=$(this).attr('id');
 var dataString = 'id='+ id ;
$.ajax({
   type: "POST",
   url: "download_number.php",
   data: dataString,
   cache: false,
   success: function(html)
   {
  $("#div_"+id).html(html);
  }  });
}

button:

<input type = "button" value="Download" class="button" id="<?php echo $id;
?>" >

div:

<div id="div_<?php echo $id; ?>" ><?php echo $downloadcount;?></div>



by the way* I totally will refuse this approach* because,although the ajax
is working,but I can't do anything for click to download the related file
because when I go to my php page I can't redirect it to a page for download
and besides echo the output to be written in div element,so that,the best
solution is just redirect to a page and download the file in first place.
after submiting write a $_POST['submit'] and just store the download
count,update the table and if user refreshed the page,can see the number of
downloads,*as sure there isn't anything better than this.*

Marco suggested me iframe,reloading it,like a manual ajax but I think it
has much of troubles.

by the way thanks for all helps.

[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