Created
August 18, 2014 19:40
-
-
Save viyatb/b3ae0fcbca5b3eb08b73 to your computer and use it in GitHub Desktop.
dynamic generate html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enterSessionData(data, status, xhr){ | |
console.log(data); | |
$.each(data, function(ind, objects){ | |
$.each(objects, function(index, obj){ | |
html = '<div class="panel panel-default"><div class="panel-heading">'; | |
html+= '<div class="panel-heading"><h4 id="token_head" a data-toggle="collapse" data-parent="#accordion" href="#token">'+obj.name+'</h4></div>'; | |
html+='<div id="token" class="panel-collapse collapse-in"><div class="panel-body"><ul class="nav nav-tabs"><li class="pull-right"><button class="btn btn-primary btn-sm"> View URL map</button></li><hr /></ul><table class="table table-bordered table-striped table-hover"><thead><tr><th> NAME </th><th> VALUE </th><th> ATTRIBUTES </th></tr></thead><tbody><tr id="token"></tr>'; | |
html+='<td id="token_name">'+obj.name+'</td>'; | |
html+='<td id="token_value">'+obj.value+'</td>'; | |
if (obj.attributes.Domain){ | |
html+='<td><ul id="token_attr_domain"></ul><b>Domain</b>: '+obj.attributes.Domain+'</ul>'; | |
} | |
if (obj.attributes.Path){ | |
html+='<td><ul id="token_attr_path"></ul><b>Path</b>: '+obj.attributes.Path+'</ul>'; | |
} | |
if (obj.attributes.Secure){ | |
html+='<td><ul id="token_attr_secure"></ul><b>Secure</b>: '+obj.attributes.Secure+'</ul>'; | |
} | |
if (obj.attributes.HttpOnly){ | |
html+='<td><ul id="token_attr_httponly"></ul><b>HttpOnly</b>: '+obj.attributes.HttpOnly+'</ul>'; | |
} | |
if (obj.attributes.Expires){ | |
html+='<td><ul id="token_attr_expires"></ul><b>Expires</b>: '+obj.attributes.Expires+'</ul>'; | |
} | |
html+='</td></tr></tbody></table></div></div></div>'; | |
return(html); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment