AJAX数据捕获

File Name: first.php

<th><button type="button" id= "pre_production" class="btn submit_button" value = <?php echo $_REQUEST["project"] ;?>><b>PRE PRODUCTION</b></button></th>

I am sending the button value to second page through AJAX

$("#pre_production").click(function()
    {
        var data_pre_production = $("#pre_production").val();
        $.ajax({
                type:"POST",
                url:"second.php",
                data:{data_pre_production},
                success:function(data){
                    //alert(data);
                }
            });
    });

In the second page I am trying to capture the button value like

Welcome Home

BUt it is showing the error like "Undefined index data_pre_production"

Please help to solve this problem..thanks

When you are creating the parameters the AJAX sends to the PHP you need to give the parameter a name and a value. The parameter name will be what you use to access that data from $_POST, $_GET or $_REQUEST as you appear to be using

data:{data_pre_production: data_pre_production},

Or maybe in this case it should be

data:{project: data_pre_production},