javascript - bootstrap table unable to load json objects -


my ajax script sends json objects browser table unable load json object. ajax script:

 $.ajax({             type : "post",             url : "getlabels.jsp",             data : "mailingid=" + selectedvalue, // poscodeselected             success : function(data) {                  response = $.parsejson(data);// statement sends data succesfully browser              },             error : function(response) {                 var responsetextobject = jquery.parsejson(response.responsetext);             }         }); 

this bootstrap table embedded jsp page.

<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> 

just let guys json response in browser:

{"rownumber":1,"mailingid":3,"firstname":"brian","lastname":"fairhurst","organization":"florida state university","city":"tallahassee","state":"fl"} 

you have add new row json object returned:

//you need set id="tbl" table on html  var table = document.getelementbyid("tbl");   var row = table.insertrow(table.rows.length); //insert new row  // insert new cells info  cells = [];  for(var = 0;i < 6;i++){     cells[i] = row.insertcell(i); }  // add information store in json object  cells[0].innerhtml = response.rownumber; cells[0].innerhtml = response.firstname; cells[0].innerhtml = response.lastname; cells[0].innerhtml = response.organization; cells[0].innerhtml = response.city; cells[0].innerhtml = response.state; 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -