I get to_user_id from another function
example
to_user_name = user.name
to_user_name = user name
If I coding like this it not working it can't find id="chat_history_user.name"
or id="chat_history_user name"
because it has special character "." , " "
function fetch_chat_history(to_user_name){
$.ajax({
url:"message_list_op.php",
method:"POST",
data:{
get_chat_history:1,
to_user_id:to_user_name
},
success: function(data){
$('#chat_history_'+to_user_name).html(data);
auto_scroll();
}
})
}
I try to use $('#chat_history_'+escape(to_user_name)).html(data);
It's not working because it's changed my
value like user name to user%20name