jQWidgets Forums

jQuery UI Widgets Forums Grid How to send data to server when bind data source

This topic contains 2 replies, has 2 voices, and was last updated by  snowyl 11 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • snowyl
    Member

    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.


    support
    Participant

    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,
    Mariya

    jQWidgets Team
    http://www.jqwidgets.com


    snowyl
    Member

    then how could I send data:”am” to server? if I use
    data: “am”
    I will get {0:’a’,1:’m’}

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.