ajaxURL behavior.
See original GitHub issueHi, I’ve been working a lot with tabulator these days… and I have been using this method to retrieve data to my table without problems.
Code Behind.
[WebMethod(CacheDuration = 0)]
public static string GetRoomList()
{
string result;
using (var ctx = new ServiceContext())
{
var roomList = (from c in ctx.Rooms
select c);
result = JsonConvert.SerializeObject(roomList);
}
return result;
}
Javascript
function createRoomData() {
$("#gridRoom").tabulator({
height: "400px",
fitColumns: true,
columns: [
{ field: "roomID", visible: false },
{ title: "Code", field: "roomCode", sorter: "string" },
{ title: "Description", field: "roomDescription" },
{ title: "Habited", field: "roomHabited", align: "center" },
],
});
}
function loadRoomData2() {
$.ajax({
url: "room.aspx/GetRoomList",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
beforeSend: function () {
// $(".l-preloader").show();
//spinner.spin(spinnerTarget);
},
success: function (data) {
var json = data.d;
$("#gridRoom").tabulator("clear")
.tabulator("setData", json);
//spinner.stop();
},
error: function (xhr, textStatus, errorThrown) {
manageError(xhr, textStatus, errorThrown);
//spinner.stop();
},
});
}
createRoomData();
loadRoomData2()
This implementation for Visual Studio C# code works fine. Now, I tried to use a different approach… use the ajaxURL option to fill my table, like This.
Javascript
function loadRoomData() {
$("#gridRoom").tabulator("setData", "room.aspx/GetRoomList", {}, "POST");
}
That implementation throws this error:
Now, I’ve seen that for ajax request to work in Visual Studio I need to specify options
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json'
So I don’t know if I can set this options using the ajaxURL or the Params in the setData function.
Could you clarify me if I’m doing something wrong?
Thanks!!
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
The correct method to pass query vars in AJAX using ajaxurl
I'm trying to override the default behavior with ajax. The problem here is not actually a problem, but a wish more. I have...
Read more >jQuery.ajax() | jQuery API Documentation
jQuery.ajax( url [, settings ] )Returns: jqXHR. Description: Perform an asynchronous HTTP (Ajax) request. version added: 1.5jQuery.ajax( ...
Read more >Jquery Ajax url path Issue - Stack Overflow
i have the ajax function in test.php. load.php is just simply echoing "wow". $("#test").click(function(){ ...
Read more >AJAX URL Selection Parameters - QlikView App Dev
AJAX URL Selection Parameters - Select Literals ... We need the behavior of this url to only select the singlevalue 'Sales'.
Read more >AJAX update and file download in one blow
getModelObject()); } }; item.add(download); item.add(new AjaxLink<Void>("link") { @Override public ... AjaxRequestTarget; import org.apache.wicket.behavior.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No issues here, works beautifully!
Hi, it’s me again, thanks a lot for the new feature, now I’m implementing it and my response using a web method is something like this.
I can’t remove that d from the response, because it is a security fix implemente by .net3.5 so I was hoping you’d now any way to get inside that d… from tabulator, using the setData function.
Right now my grid doesn’t show any data. but it is returned correctly