jQuery is stripping out HTML, I don't know why
This code works perfectly, but when I will put the final HTML, only appears the values, but the HTML not. What is happening??
$('[role=query-username]').live( 'click', function() {
var output = "<table>";
$.post(
'/action/jsonUserInformation.php',
'username=' + $('#username').val(),
function(data) {
$('#user_results').html('');
var data_json = $.parseJSON( data );
$.each( data_开发者_开发问答json, function() {
$.each( this, function(i, v)
{
output = output + "<tr><td>" + i + "</td><td>" + v + "</td></tr>";
});
output = output + "</table>";
});
$('#user_results').html( output );
});
});
Result Output is: code37username_code41account_passwordfb8465e62c8b2bd01d1d14965748b3e4account_status2account_type1creationdate2008-10-23mail_code39confirmedbb022e5a2419271daa2764f9cad5500crecoveryenabledreferrertimezonepreferred_currencycomission_plan1basemoney0privileges5paywaypersonal_info37last_update2008-10-23 00:00:00nameslastnamessexaddressphonemobilezipcitystatecountryidbusinessnameprofessionbirthdateaccount37usernamecjimenezhkemailyoyo@cjimenezhk.com
I'm not sure what you mean by "put the final HTML", but you should definitely move the
output = output + "</table>";
outside of your outer each loop.
Move it just before $('#user_results').html( output );
精彩评论