Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   phphq.Net Forums (https://novahq.net/forum/forumdisplay.php?f=277)
-   -   Trying to get php script to work with ajax(jquery) (https://novahq.net/forum/showthread.php?t=46060)

alvidales 06-28-2011 10:24 AM

Trying to get php script to work with ajax(jquery)
 
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.


All times are GMT -5. The time now is 10:56 AM.

Powered by vBulletin®