jQuery UI Widgets Forums Plugins Data Adapter Passing data with dataAdapter

This topic contains 1 reply, has 1 voice, and was last updated by  Tyl 11 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Passing data with dataAdapter #48350

    Tyl
    Participant

    Hi,

    I need to send a parameter (named table_name) to my php file on the server.
    I saw in the documentation that I could use the POST method.
    That’s what I did in the following code, but I don’t get the data in my php file.
    However, I use POST method to send data to my php file with $.ajax() and it works perfectly.

    Works :

    $.ajax({
    		url : 'php/remove_user.php',
    		type : 'POST',
    		data : 'id='+id_user,
                    ...

    Does not work:

      var movies_data_source =
      {
        url : 'php/get_movies.php',
        type : 'POST',
        data : 'table_name=Collection_1_1',
        dataType : 'xml',
        id: 'Id',
        datafields: [
          { name: 'Id', type: 'string' }
        ],
        root: 'Movies',
        record: 'Movie'
      };
    
      var dataAdapter = new $.jqx.dataAdapter(movies_data_source, {
        loadComplete: function (data) {
             var records = dataAdapter.records;
             var length = records.length;
             alert('loadComplete length = ' + length);
        },
      });
    Passing data with dataAdapter #48352

    Tyl
    Participant

    I found what was wrong, I had to use a different format to pass my data.

    I have to use
    data: {table_name: table_name}
    instead of
    data: “table_name=”+table_name

    Not very clear in the doc however, but found it ;o)

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

You must be logged in to reply to this topic.