oh my bad:)! there is a cool solution,I forgot the blank page!:) yep!
solved:)
window.open('download.php', '_blank' );
now I can count up,and download:)
$(".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);
} });
window.open('download.php', '_blank' );
});
so cool!!:)
On Mon, Oct 15, 2012 at 7:42 PM, Negin Nickparsa <[email protected]>wrote:
> 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.
>
>
>
>