weixin_33675507 2011-08-17 19:18 采纳率: 0%
浏览 31

jQuery ajax没有PHP响应

My script runs fine and it alerts me the data is saved. but for Debug reason I want to see the PHP ("Procees.php") response as well in html format. I can see it in firebug but I do not know how to out put it using jquery. My codes are as follows;

            var dataString ='doctype='+ doctype + '&paytype=' + paytype + '&docno=' + docno + '&bookno=' + bookno + '&prname=' + prname +'&pename='+pename+'&paydate='+paydate+'&inpdate='+indate 
        +'&e1='+e1 +'&e2='+e2 +'&e3='+e3 +'&e4='+e4 +'&e5='+e5 +'&e6='+e6 +'&e7='+e7 +'&e8='+e8 
        +'&accname1='+accname1 +'&accname2='+accname2 +'&accname3='+accname3 +'&accname4='+accname4 +'&accname5='+accname5 +'&accname6='+accname6 +'&accname7='+accname7 +'&accname8='+accname8 
        +'&dr1='+dr1 +'&dr2='+dr2 +'&dr3='+dr3 +'&dr4='+dr4 +'&dr5='+dr5 +'&dr6='+dr6 +'&dr7='+dr7 +'&dr8='+dr8
        +'&cr1='+cr1 +'&cr2='+cr2 +'&cr3='+cr3+'&cr4='+cr4 +'&cr5='+cr5 +'&cr6='+cr6 +'&cr7='+cr7 +'&cr8='+cr8 +'&ref='+ref;


        //alert (dataString);return false;
        $.ajax({
        type: "POST",
        url: "bin/process.php",
        data: dataString,
        cache:false,
        datatype: 'json',               
        success: function(data) {

        $('#display').html("<h2>Data submitted!</h2>")
        .append("<p>Wait........</p>")
        .hide()
        .fadeIn(1500, function() {
        $('#display').append("<img id='checkmark' src='images/check-black.jpg' />");
        $('#display').html("<h3>Being Processed...</h3>")
        .fadeIn(1500, function() {
        $('#display').append("Saved <img id='checkmark' src='images/check-black.jpg' />")
        $('#thisfrm').get(0).reset();
        $("#indate").val(indate)






        });

        });
        }
        });


        return false;   

My PHP echos

                echo 'This is processing file.
';


            $doctype = $_REQUEST['doctype'];
            $paytype = $_REQUEST['paytype'];
            $docno = $_REQUEST['docno'];
            $bookno = $_REQUEST['bookno'];
            $prname = $_REQUEST['prname'];
            $pename = $_REQUEST['pename'];
            $paydate = $_REQUEST['paydate'];
            $inpdate = $_REQUEST['inpdate'];
            $ref = $_REQUEST['ref'];


            echo $doctype."<br>";
            echo $paytype."<br>";
            ....
            ... and so on

but it is not shown anywahere on the webpage.

Thanks in advance for any help .

  • 写回答

3条回答 默认 最新

  • weixin_33675507 2011-08-17 19:22
    关注

    You need to json_encode your response since your jQuery is expecting json!

    echo json_encode(array("doctype"=>$doctype, "paytype"=>$paytype));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试