Extracting Ajax return data in jQuery

后端 未结 6 1039
臣服心动
臣服心动 2020-11-29 01:36

I have done jQuery and Ajax, but I am not able to get the response into a Div element. This is the code:

Index.html

$.ajax({
    typ         


        
6条回答
  •  青春惊慌失措
    2020-11-29 01:58

    I have noticed that your success function has the parameter "html", and you are trying to add "data" to your elements html()... Change it so these both match:

    $.ajax({
        type:"POST",
        url: "ajax.php",
        data:"id="+id ,
        success: function(data){
            $("#response").html(data);
        }
    });
    

提交回复
热议问题