我有一个页面,其中有表格,每行都有一个图标以获取详细信息。单击该图标时,我将该行的唯一标识符转换为datastring并发送AJAX请求。我收到了回复,但无法得到正确的回复。为什么我做错了?我需要访问home.php中的$ desc,如何在响应中捕获它?
home.php
$.ajax({
type: "POST",
url: "actionone.php",
data: dataString,
cache: true,
success:function() {
alert("success");
}
});
actionone.php
if(isset($_POST['content']))
{
$content=(int)$_POST['content'];
$fetch = mysql_query("SELECT ISSUEDESCRIPTION FROM issues WHERE KBID =$content");
while($rowe = mysql_fetch_array($fetch))
{
$desc = $rowe['ISSUEDESCRIPTION'];
}
答案 0 :(得分:0)
对于ajax成功的工作,你输出一些PHP代码 即将PHP代码更改为
if(isset($_POST['content']))
{
$content=(int)$_POST['content'];
$fetch = mysql_query("SELECT ISSUEDESCRIPTION FROM issues WHERE KBID =$content");
while($rowe = mysql_fetch_array($fetch))
{
$desc = $rowe['ISSUEDESCRIPTION'];
}
echo $desc;
}
<强> JQUERY 强>
$.ajax({
type: "POST",
url: "actionone.php",
data: dataString,
cache: true,
success:function(data) {
alert(data.trim());
}
});