dongrong8972 2015-07-08 08:36
浏览 104
已采纳

没有从php中的ajax请求收到响应

I have a page where there is table and each row has a icon for detailed information. When the icon is clicked, I get the unique identifier for that row into datastring and send a AJAX request. I get a response but cannot catch the correct response. Why is that I am doing wrong? I need to access the $desc in home.php , how to catch that in response ?

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'];
} 
  • 写回答

1条回答 默认 最新

  • dongyue8640 2015-07-08 08:40
    关注

    For ajax success work you output some from php code ie Change php code to

    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()); 
        }
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

    报告相同问题?

    悬赏问题

    • ¥15 关于#c++#的问题:在A和B类中应该怎么定义复制构造函数来避开unordered_set复制构造的问题(相关搜索:头文件)
    • ¥15 MICE包多重插补后数据集汇总导出
    • ¥15 一道算法分析问题(关于3-MSAT)
    • ¥15 C++ FLUENT 化学反应速率 编写困难
    • ¥15 Python嵌套交叉验证
    • ¥15 linuxkit+elasticsearch
    • ¥15 兄得萌6.13do题😭😭大一小东西的work
    • ¥15 投不到原始数据,gdal投影代码
    • ¥20 卷积混响的代码帮写。。
    • ¥88 借助代码处理雷达影像,识别任意区域洪水前后的被淹没区域,并可视化展示。