Bootstrap Table - dummy ajax
// Bootstrap Table - dummy ajax example using jsfiddle "/echo/json/". Created to help answer https://github.com/wenzhixin/bootstrap-table/issues/#1998
HTML
<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.css">
<script src="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.js"></script>
<table data-toggle="table" data-url="http://mikepenz.com/jsfiddle/" data-pagination="true" data-side-pagination="server" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-height="300">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id" data-align="right" data-sortable="true">Item IDs</th>
<th data-field="name" data-align="center" data-sortable="true">Items Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
<tbody>
<tr>
<td data-field="state">test</td>
<td>dasdas</td>
<td>dfgdfgdf</td>
<td>ewrewrew</td>
</tr>
</tbody>
</table>
<div class='wrapper'>
<p>JSON will be received in 3 seconds</p>
<div id='post'></div>
</div>
JavaScript
// Bootstrap Table - dummy ajax example using jsfiddle "/echo/json/"
// Created to help answer https://github.com/wenzhixin/bootstrap-table/issues/#1998
var data = {
json: JSON.stringify({
text: 'some text',
array: [1, 2, 'three'],
object: {
par1: 'another text',
par2: [3, 2, 'one'],
par3: {}
}
}),
delay: 3
}
$(document).ready(function() {
$.ajax({
url: "/echo/json/",
data: data,
type: "POST",
success: function(response) {
console.log(response);
$("#post").append("<pre>" + JSON.stringify(response) + "</pre>");
}
});
});