problem description
failed to load json using bootstrap-table
the environmental background of the problems and what methods you have tried
the choice of parameter configuration has been tried, and onLoadSuccess can execute
.related codes
/ / Please paste the code text below (do not replace the code with pictures)
$(function () {
//1.Table
var oTable = new TableInit();
oTable.Init();
});
var TableInit = function () {
this.Init = function () {
showGrid();
};
};
function showGrid() {
var strURL = " ../../Model/HYSTJ/data.json";
$("-sharpdyxxtable").bootstrapTable({
url: strURL,
method: "GET", //*
////dataType:"json",
////contentType: "application/x-www-form-urlencoded",
//cache: true, //true*
//sortable: false, //
//sortOrder: "asc", //
queryParamsType: "limit", //,RESTFul
sidePagination: "server", //:clientserver*
//strictSearch: true,
///// height: 200, //height
//singleSelect: false,
columns: [{
field: "XH",
title: "",
align: "center"
}, {
field: "DYH",
title: "",
align: "center"
}],
responseHandler: function (res) {
return {
"total": res.total, //
"rows": res.rows //
};
},
onLoadSuccess: function (data) {//
alert("data success");
//
//setEmptyValue();
},
onLoadError: function (data) {
alert(data);
}
});
}
my json data
{
"total": 1,
"rows": [
{
"XH": 1,
"DYH": "hello"
}
]
}
this is the result, and the data is not loaded.