InnerHtml使用类[关闭]

i am working on a website using PHP and JQuery. I am retrieving the data that i want on the click event but when i get the response from the database the innerHtml is not working.Any help is appreciated

$(document).ready(check_messages);

function check_messages() {
    $('.mes_det').click(get_message);
}

function get_message() {

    var name = $(this).find(".name").html();
    var time = $(this).find(".time").html();
    $.get('find_message_text.php?name=' + name + "&time=" + time + "&send=0", function (data) {
        $(this).find(".message_Text").html(data)
    });
}

In the context of $.get function, this doesn't refer to the clicked element, you should cache the this object.

var $this = $(this);
$.get('...', function (data) {
    $this.find(".message_Text").html(data);
});

Within the response function of $.get you can't use this as referred to your html element. Try using this function:

function get_message() {

    var name = $(this).find(".name").html();
    var time = $(this).find(".time").html();
    var elem = this;
    $.get('find_message_text.php?name=' + name + "&time=" + time + "&send=0", function (data) {
        $(elem).find(".message_Text").html(data)
    });
}