Launch php file using javascript

Hi all

I have a table, and when I click on a specific row I want to open a php file using a field from the row value I clicked to filter only results on a table using that clicked value of the row.

I attempted the following:

<script type="text/javascript">
  $(document).ready(function () {
     $('table tbody tr').click(function () {
        var col1 = $(this).find('td:eq(0)').text();
        $.ajax({
            url:'mydeals.php',
            method:'GET',
            data:{cnumber:col1},
            success:function(data)
                {
                    alert("Success");
                },
            error:function(data)
                {
                    alert("error");
                }
            });
        });
    });
</script>

It says Success but the php mydeals.php file does not open.

You really should show the HTML and php file for us to better grasp the problem, plus you should do

console.log(data);

In order to see what data (if any data) you are getting back

Sponsor our Newsletter | Privacy Policy | Terms of Service