jQWidgets Forums

jQuery UI Widgets Forums Plugins Data Adapter Sending JSON to server

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Sending JSON to server #53215

    rskbuvan
    Spectator

    Hi,

    I’m trying to send the JSON data request to server but when I see the POST data in debugger, it is in the following format not in JSON format,
    filterscount=0&groupscount=0&pagenum=0&pagesize=10&recordstartindex=0&recordendindex=14.606060606060606 &token=YAR40wB2u671jyZ9TlojveZfbosGYGVZ

    Sample code:

    var csrf={token:$('#csrftoken').val()}; 
    var latestUsersource = 
    { 
    datatype: "json", 
    type: 'POST', 
    data:csrf, 
    contentType : "application/json;charset=UTF-8", 
    datafields: [ 
       { name: 'firstName', type: 'String'}, 
       { name: 'lastName', type: 'String'}, 
       { name: 'webSsoId', type: 'String'}, 
       { name: 'status', type: 'String'}, 
       { name: 'action', type: 'String' }, 
       { name: 'displayValue', map : 'lastModifier>displayValue', type: 'String' }, 
       { name: 'lastModifiedDt', type: 'String' }, 
       { name: 'statusImg', type: 'String'}, 
       { name: 'consumerId', type: 'Long'}, 
       { name: 'ctlFL', type: 'String'} 
      ], 
    root:"userList", 
    url: usersChangesUrl      
    }; 
    
    var LatestUserdataAdapter = new $.jqx.dataAdapter(latestUsersource);

    It seems that, jqx library is not converting object to JSON notation. Because, when I debugged the code in “jqx-all.js”
    by adding data: JSON.stringify(ac) at the place where data types are handled then my code is working fine.

    Can anyone suggest me a solution?

    Thanks in advance.

    Cheers,
    Senthil

    Sending JSON to server #53226

    Peter Stoev
    Keymaster

    Hi Senthil,

    The data member is automatically converted by the jQuery’s Ajax function. I suggest you to read this help tutorial: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-extra-http-variables.htm. It shows how to send parameters.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.