javascript - Problem with ajax not being able to obtain data?
天蓬老师
天蓬老师 2017-05-27 17:42:15
0
3
600
$(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 is a button. After binding a click event to it, send an ajax request to the background and check the console that everything is normal. There are no errors in the parameters and URL.

But it just can’t print out ddd? Can you help me find out what’s wrong?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all (3)
世界只因有你

Sister, you don’t have a console, how can you print? success:function(){

$(oZs).fadeOut("fast"); $(oCx).fadeIn("fast"); } 改成 success:function(data){ console.log(data); $(oZs).fadeOut("fast"); $(oCx).fadeIn("fast"); }
    阿神

    Ajax is not used like this. You pass the value, but if you echo something in the index, it cannot be seen on the other side.
    You set up a success callback and receive data processing here.
    I prefer json For transmission, if you use json, you can echo json_encode your data in the controller

      世界只因有你

      This is embarrassing. Isn’t the returned data a return? ? ? ? ? ? ? ? ? ? Forgive my ignorance

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!