Until now for list of sections I was using this and it was working as intended
var sections = [{ key: 1, label: 'Prva soba' }]
I now want to get sections from DB. I have used this code for that
$.ajax({
url: "naziv.asmx/RoomListUnit",
data: "{ 'skolaID': 'some ID goes here'}",
dataType: "json",
async: false,
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
sections = data.d.toString();
}
});
It is not working. When I try alert(sections) the data is good. But sections are not loading on unit view