Skip to content

Instantly share code, notes, and snippets.

@shamun
Created May 29, 2011 16:43
Show Gist options
  • Save shamun/997930 to your computer and use it in GitHub Desktop.
Save shamun/997930 to your computer and use it in GitHub Desktop.
When i receive this JSON data using jQuery, it shows correctly in my alert(),
But when i use jQuery append() or html(), then it does not work, specially the
following html values becomes empty.
1. <span class=\"hide\">5<\/span>
2. <span class=\"single_user_username\">1003<\/span> (<span class=\"single_user_status\">waiting<\/span>)
JQuery:
=========
$.ajax({
type : "GET",//POST
dataType: 'json',
url : url,
data : datas,
async : true,
beforeSend: function(){ajaxon();},
complete: function(){ajaxoff();},
success : function(msg)
{
alert(msg.result);
//$(render).empty().append(msg.result); // same result
$(render).html(msg.result);
}
});
{"result":"<div class=\"single routing_users\" style=\"overflow:auto;\">\n <span class=\"hide\">5<\/span> \n <div style=\"float:left;width: 200px;padding: 4px;\">\n <div class=\"single_users monitor_users\" style=\"padding-right: 10px;\">\n <div style=\"background:#333333;\">\n <img src=\"\/img\/icon\/agent.png\"\/>\n <\/div>\n <div style=\"background: white; padding: 2px; border-top: solid 1px #666666;\">\n <img src=\"\/img\/icon\/online.png\" class=\"head_status\"\/> ID: <span class=\"single_user_username\">1003<\/span> (<span class=\"single_user_status\">waiting<\/span>)\n <\/div>\n <\/div> \n <\/div>\n <div style=\"float:left;width: 670px; padding:4px;\">\n <div>\n System: <\/div>\n \n <button name=\"button_monitor_ping\" id=\"button_monitor_ping\" type=\"button\" value=\"Ping\">Ping<\/button> <button name=\"button_monitor_disconnecct\" id=\"button_monitor_disconnecct\" type=\"button\" value=\"Disconnect\">Disconnect<\/button> <button name=\"button_monitor_poweron\" id=\"button_monitor_poweron\" type=\"button\" value=\"Power on\">Power on<\/button> <button name=\"button_monitor_standby\" id=\"button_monitor_standby\" type=\"button\" value=\"Stand by\">Stand by<\/button> <button name=\"button_monitor_reboot\" id=\"button_monitor_reboot\" type=\"button\" value=\"Reboot \">Reboot <\/button> <\/div>\n<\/div>"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment