我遇到問題。 我想要發生的事情: 1.單擊表格字段時創建一個彈出式div。 (/) 2.將項目從PHP文件中彈出div,該文件回顯包含信息的另一個表格。 () 3.幫幫我。 ()將PHP文件的動態HTML表格腳本響應傳遞給AJAX
所以我有這個簡單的jQuery處理點擊某個表字段(特別是第一列),裏面是一個ajax請求,它發送和從schedule_class.php提取數據。但我希望將schedule_class的回聲插入到我的div中,並將其作爲id使用。
MY AJAX SPLICE:
$.ajax({
type:"POST",
url: "schedule_class.php",
dataType:"json",
data: dataString,
success: function(data)
{
$("#pop").html().load('/sched_class.php');
},
});
MY DIV
<div id="pop"></div>
SCHEDULE_CLASS.PHP
<?php
include("connect.php");
session_start();
$toggle = $_POST['toggle'];
$sub_code = $_POST['pe_code'];
if($toggle == 0)
{
$_SESSION['pe_code'] = $sub_code;
$response['status'] = $sub_code;
echo // this echo should have been in the pop-up div
'<table class="tbl_sched" align="center" style="position:absolute;width:95%;">'.
'<thead class="tbl_sched_row_title">
<tr>
<td style="padding:3px 20px"><b>'."CODE".'</b></td>
<td style="padding:3px 50px"><b>'."SUBJECT".'</b></td>
<td style="padding:3px 50px"><b>'."STUDENT".'</b></td>
<td style="padding:3px 30px"><b>'."STUDENT#".'</b></td>
<td style="padding:3px 15px; margin-right: 20px;"><b>'."COLLEGE".'</b></td>
</tr>
</thead>
<tbody class="tbl_sched_row" style="height:inherit">';
...
...
?>
我相信它應該有工作。但它沒有,我錯了。請幫幫我。提前致謝。
它是'schedule_class.php'還是'sched_class.php'?因爲你告訴jquery在'$(「#pop」)。html()。load('/ sched_class.php');' –
'上加載'shed_class.php'如果你在dataType中加入「json」,你必須編碼你從PHP回聲。 – Arleal
@Seckin哦,它真的schedule_php,我改變了他們,仍然不工作 –