Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过ajax将用户id从mysql传递到引导模式_Php_Jquery_Mysql_Ajax_Twitter Bootstrap - Fatal编程技术网

Php 通过ajax将用户id从mysql传递到引导模式

Php 通过ajax将用户id从mysql传递到引导模式,php,jquery,mysql,ajax,twitter-bootstrap,Php,Jquery,Mysql,Ajax,Twitter Bootstrap,我想通过ajax将表中的用户id传递给modal,但我只想得到“未定义”。 当我替换var-dataString='id='+recipient时 使用var-dataString='id='+1它工作正常,所以出于某种原因,我无法在单击变量时获取值。我错过了什么 PHP: PHP: 您使用的是哪个版本的jQuery?console.log(数据)的输出是什么?XHR已完成加载:获取“Modal_user.php?id=undefined&uu=1427126141123”。未捕获引用错误:未

我想通过ajax将表中的用户id传递给modal,但我只想得到
“未定义”
。 当我替换
var-dataString='id='+recipient时
使用
var-dataString='id='+1它工作正常,所以出于某种原因,我无法在单击变量时获取值。我错过了什么

PHP:

PHP:



您使用的是哪个版本的jQuery?console.log(数据)的输出是什么?XHR已完成加载:获取“Modal_user.php?id=undefined&uu=1427126141123”。未捕获引用错误:未定义数据
<?php

                        $query = mysql_query("select * from users");
                        $i=0;
                        while($fetch = mysql_fetch_array($query)):



                        echo '<tr>';
                        echo'<td> '.$fetch['user_id'].'</td>';
                        echo'<td> '.$fetch['user_name'].'</td>';
                        echo'<td> '.$fetch['user_email'].'</td>';
                        echo'<td> '.$fetch['user_imie'].'</td>';
                        echo'<td> '.$fetch['user_nazwisko'].'</td>';
                        echo'<td> '.$fetch['user_telefon'].'</td>';
                        echo'<td> '.$fetch['user_konto_akty'].'</td>';
                        echo'<td> '.$fetch['user_uprawnienia'].'</td>';
                        echo'<td>' .date("d.m.Y, H:i", $fetch['user_regdate']). '</td>';

                        echo'<td>  <a class="btn btn-primary btn-sm" href="Kasuj_tab.php?user_id='.$fetch['user_id'].'">Usuń</a></td>';

                       ?>
                                <td>
                                    <a class="btn btn-small btn-primary" data-toggle="modal" data-target="#exampleModal_user" data-whatever1="<?php echo $fetch['user_id']; ?>">Edit</a></td>

                    <?php
                            echo '</tr>';
                        endwhile;
                    ?>
  $('#exampleModal_user').on('show.bs.modal', function (event) {
          var button = $(event.relatedTarget) // Button that triggered the modal
          var recipient = button.data('whatever1') // Extract info from data-* attributes
          var modal = $(this);
          var dataString = 'id=' + recipient;

            $.ajax({
                type: "GET",
                url: "Modal_user.php",
                data: dataString,
                cache: false,
                success: function (data) {
                    console.log(data);
                    modal.find('.ct').html(data);
                },
                error: function(err) {
                    console.log(err);
                }
            });  
    })
<?php
include 'Panel_Logowanie/config.php';
db_connect();

$id = $_GET['id'];  
echo"$id";


?>