jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How to send data to server when bind data source
Tagged: Send data to server
This topic contains 2 replies, has 2 voices, and was last updated by snowyl 11 years, 11 months ago.
-
Author
-
I want send “action”=”am” to server. but when I use context.Request[“action”] at page ajax/company.ashx, I got null.
My code is:var url = “ajax/company.ashx?ts=”+new Date();
var actiondata = {};
actiondata[“action”] =”am”;var amsource = {
datatype: “json”,
type: “POST”,
date:actiondata,
datafields: [
{ name: ‘staffid’ , type: ‘int’},
{ name: ‘Name’ , type: ‘string’},
],
id: ‘staffid’,
url:url
}
var amdataAdapter = new $.jqx.dataAdapter(amsource);what’s wrong?
Also I can get the “action” in addrow of another data source
var source = {
datatype: “json”,
datafields: [
{ name: ‘ID’ , type: ‘int’},
],
id: ‘ID’,
url:url,
addrow: function (rowid, actiondata, position, commit) {
$.ajax({
cache: false,
dataType: ‘json’,
url: ‘ajax/SupplierRequest.ashx?ts=’+new Date(),
data: actiondata,
type: “POST”,
success: function (data, status, xhr) {
// update command is executed.
rowdata[“ID”] =data[0][“ID”];
commit(true);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
commit(false);
}
});
}
}
Thank you.Hi snowyl,
Actiondata is not passed to the server because the expected field name is data instead of date. If you have any further questions do not hesitate to contact us.
Best Wishes,
MariyajQWidgets Team
http://www.jqwidgets.comthen how could I send data:”am” to server? if I use
data: “am”
I will get {0:’a’,1:’m’} -
AuthorPosts
You must be logged in to reply to this topic.