Hi there, i'm new in this forum i'm wondering if is there anyone who could help me with this.
I'm trying in one php file to call from a button
Code:
<input type="button" onclick="javascript:exportexcel(<?=$month?>, <?=$year?>"/>
and the code for the js function is:
Code:
function exportexcel(month, year){
$.ajax(
{
url: 'exportexcel.php',
cache: false,
contentType: "application/x-www-form-urlencoded",
dataType: "html",
success: function()
{
//alert('something');
$('#msg').html('Sales report build succesfully');
$('#msg').css('display', 'inline-block');
},
type: "POST",
data:"month="+month+"&year="+year+""
});
}
if i uncomment the alert, it shows the alert window, but i can't make it to work, the file exportexcel.php generates data and exports it to excel, afterwards it sends prompt to user to save it or it just starts to download, is there any other way to make it work??, thx in advance.