无法使用发布请求将数据发送到服务器

时间:2015-12-25 04:48:34

标签: php post curl request server

我有2个文件。

档案one.php

Table#2

文件 one.php 我向 process.php 文件发送一个获取请求。这是文件 process.php

<?php 
    include 'config/dbconnect.php';
    $query = mysql_query("select * from getgift_logs where status = 1") or die(mysql_error());
    echo("<table border='1'>");
    echo("<tr>");
        echo("<td>User ID</td>");
        echo("<td>Yes</td>");
    echo("</tr>");
    while ($row = mysql_fetch_array($query)) {
        echo("<tr>");
        echo("<td>".$row['user_id']."</td>");
        echo "<td><button class='yes' gift_id = '".$row['id']."'>Yes</button></td>";
        echo("</tr>");
    }
    echo("</table>");
 ?>
 <div id='result'></div>
<script type = "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
 <script>
    $('.yes').click(function() {
        var trans_id=$(this).attr("gift_id");   
    $.ajax({
    url : "process.php?id="+trans_id,
    type: "GET",  
    success:   function(result) {
         $('#result').html(result);
         },  
        });
       });
    </script>

process.php 文件中,我发送 POST REQUEST 但它不起作用(它不向服务器发送数据)。

我不知道我错了什么?请帮我!谢谢大家!

1 个答案:

答案 0 :(得分:0)

试试这个

{{1}}
相关问题