猿问

关于ajax无法获取到数据的问题?

$(oFind).bind('click',function(){

        var oKeyword = $('.locating').val();

        if( oKeyword != '' ){

            $.ajax({

                type:"post",

                async:true,

                url: "{:U('Reply/index')}",

                data:{keyword:oKeyword},

                success:function(){

                    $(oZs).fadeOut("fast");

                    $(oCx).fadeIn("fast");

                }

            });

        }

    });

oFind是个按钮,给他绑定一个点击事件以后,向后台发送ajax请求,查看控制台一切正常,所带参数,url均无错误,

<?php

namespace Home\Controller;

use Think\Controller;


class ReplyController extends CommonController {

    public function index(){

        if($_POST){

            

            echo "ddd";


        }

 

     }

}

但是 就是打印不出ddd? 帮俺看看哪有错?

jeck猫
浏览 371回答 1
1回答

POPMUISE

大姐 你都没console 怎么会打印? success:function(){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(oZs).fadeOut("fast");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(oCx).fadeIn("fast");&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; 改成&nbsp; success:function(data){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(data);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(oZs).fadeOut("fast");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(oCx).fadeIn("fast");&nbsp; &nbsp; &nbsp; &nbsp; }
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答