0
我的ajax脚本发送json对象给浏览器,但表无法加载json对象。 我的Ajax脚本:bootstrap表无法加载json对象
$.ajax({
type : "POST",
url : "getLabels.jsp",
data : "mailingID=" + selectedValue, // posCodeSelected
success : function(data) {
response = $.parseJSON(data);// this statement sends data succesfully to browser
},
error : function(response) {
var responseTextObject = jQuery.parseJSON(response.responseText);
}
});
这是我举表嵌入到我的jsp页面。
<table data-height="299" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-select-item-name="toolbar1">
<thead>
<tr>
<th data-field="rowNumber" >ID</th>
<th data-field="firstname" >first name</th>
<th data-field="lastname" >last name</th>
<th data-field="organization" >organization</th>
<th data-field="city" >city</th>
<th data-field="state" >state</th>
</tr>
</thead>
</table>
只是为了让你们现在这是浏览器的json响应:
{"rowNumber":1,"mailingID":3,"firstname":"Brian","lastname":"Fairhurst","organization":"Florida State University","city":"Tallahassee","state":"FL"}
什么是你用'response'你解析JSON后做什么? – 2014-12-05 18:33:00
此主题可能对您有帮助吗? http://stackoverflow.com/questions/25187349/bootstrap-table-showing-json-data – 2014-12-05 18:33:15
@BlaiseSwanwick:是的,你提供的链接有加载json文件的表属性data-url =“test.json”。但在我的情况下,我不得不将json对象(响应)加载到表中。 – nikhilk 2014-12-05 18:38:42