php array to external page using jquery
I have a php page to creates a multi-dimentional array called $results.

I would like to:

 1. catch submit of a form button
 2. override default behavior of the submit using jQuery
 3. copy and process $results on separate php using $.post

I have this which is not currently working and am not sure why?:

    <form id='download_to_excel' method="post">
    <input type="image" name="submit" value="submit" id='xls_download_button' src='images/common/buttons/download.png'> 
    </form>
    <?php 
    $json_results = json_encode($results);
    ?>
    <script type='text/javascript' >
    $(document).ready(function(){ 
    alert($json_results);
    $("#xls_download_button").click(function(e){ 
    alert('clicked');
    e.preventDefault(); 
    download_xls(); 
    }); 
    function download_xls(){
    $.post('./libs/common/export_data_to_excel.php', {json_data : json_results};
    }
    }); 
    </script>

When selecting the xls_download_button, the alert() never fires nor does any data get passed to export_data_to_excel.php

The export_data_to_excel.php file has the following:

    <?php 
    $results = json_decode($json_data);
    //do stuff with $results...
    ?>

I do know that the $json_results does display proper json encoded values when echoed. But from there are not sure why the rest of the javascript does not run; the alerts never fire nor does the json data get passed? 

Can you see why this isn't working?

Regards,
Steve
php array to external page using jquery
===

I have a php page to creates a multi-dimentional array called $results.

I would like to:

 1. catch submit of a form button
 2. override default behavior of the submit using jQuery
 3. copy and process $results on separate php using $.post

I have this which is not currently working and am not sure why?:

    <form id='download_to_excel' method="post">
    <input type="image" name="submit" value="submit" id='xls_download_button' src='images/common/buttons/download.png'> 
    </form>
    <?php 
    $json_results = json_encode($results);
    ?>
    <script type='text/javascript' >
    $(document).ready(function(){ 
    alert($json_results);
    $("#xls_download_button").click(function(e){ 
    alert('clicked');
    e.preventDefault(); 
    download_xls(); 
    }); 
    function download_xls(){
    $.post('./libs/common/export_data_to_excel.php', {json_data : json_results};
    }
    }); 
    </script>

When selecting the xls_download_button, the alert() never fires nor does any data get passed to export_data_to_excel.php

The export_data_to_excel.php file has the following:

    <?php 
    $results = json_decode($json_data);
    //do stuff with $results...
    ?>

I do know that the $json_results does display proper json encoded values when echoed. But from there are not sure why the rest of the javascript does not run; the alerts never fire nor does the json data get passed? 

Can you see why this isn't working?

Regards,
Steve