{"action":"created","issue":{"url":"https://api.github.com/repos/DataTables/DataTables/issues/490","labels_url":"https://api.github.com/repos/DataTables/DataTables/issues/490/labels{/name}","comments_url":"https://api.github.com/repos/DataTables/DataTables/issues/490/comments","events_url":"https://api.github.com/repos/DataTables/DataTables/issues/490/events","html_url":"https://github.com/DataTables/DataTables/issues/490","id":56606852,"number":490,"title":"AJAX Bug using $().serialize/.serializeArray() in DataTables v1.10.3","user":{"login":"vol7ron","id":1009203,"avatar_url":"https://avatars.githubusercontent.com/u/1009203?v=3","gravatar_id":"","url":"https://api.github.com/users/vol7ron","html_url":"https://github.com/vol7ron","followers_url":"https://api.github.com/users/vol7ron/followers","following_url":"https://api.github.com/users/vol7ron/following{/other_user}","gists_url":"https://api.github.com/users/vol7ron/gists{/gist_id}","starred_url":"https://api.github.com/users/vol7ron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vol7ron/subscriptions","organizations_url":"https://api.github.com/users/vol7ron/orgs","repos_url":"https://api.github.com/users/vol7ron/repos","events_url":"https://api.github.com/users/vol7ron/events{/privacy}","received_events_url":"https://api.github.com/users/vol7ron/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-04T23:53:56Z","updated_at":"2015-04-17T16:40:07Z","closed_at":"2015-02-06T09:08:23Z","body":"http://datatables.net/forums/discussion/25884/datatables-odd-ajax\r\n\r\n**Important! The implications of following problem results in ServerSide processing being inaccessible, making it seemingly impossible to work with large datasets**\r\n\r\nWhen passing in `$('form').serialize()` for AJAX params, it is breaking up the string and sending each character its own value.  \r\n\r\n    {\r\n        ajax: { \r\n           url:  window.location.pathname,  // calling the correct url\r\n           data: $('form').serialize(),     // am sure this is resolving to a string, like 'key=value&key2=value2'\r\n           type: 'POST'                     // tried GET, JSON, and leaving it blank\r\n        },\r\n        ...\r\n    }\r\n\r\nSo given the serialized example above of `key=value&key2=value2`, debugging in Firebug shows DataTables is breaking the string into tokens and sending each as an individual set of arguments to make it look like token index is the key and the characters are the value:\r\n\r\n    1 k\r\n    2 e\r\n    3 y\r\n    4 =\r\n    5 v\r\n    ...etc\r\n\r\nI'm curious if this has anything to do with Rails putting in special form UTF-8 values.  The only way I can get this to work is to execute a look up separately using `$.ajax()` and creating the datatable in the callback (somewhat assuring me special characters aren't at fault); the following works:\r\n\r\n    $.ajax({\r\n       url:  window.location.pathname,\r\n       data: $('form').serialize(),\r\n       type: 'POST'\r\n       success: function(response){\r\n          createDataTable( response.data );\r\n       }\r\n    });\r\n\r\nThe HTTP request using the jQuery ajax function above works as expected and passes the arguments like so `key : value`, `key2 : value2`.  So why would DataTables break up the string?  This leads me to believe there is a bug somewhere, which would render the AJAX functionality useless.\r\n\r\n---\r\n\r\n### Even Odder\r\n\r\n`data: $('form').serializeArray()` works, but if I try to store it in a variable and add a parameter to the array, I get funny results in the request.  An example of doing this is:\r\n\r\n    var form_data = $('form').serializeArray();\r\n    form_data.push({ 'name' : 'dynamic_param', 'value' : 'dynamic_param_value' });\r\n    // DataTable({ ajax : { ..., data: form_data }, ...)\r\n\r\nNow in the debugger the parameters look like this, notice it's back to using the index, but has also started using the object property as the HTTP param key:\r\n\r\n    0[name]  key\r\n    0[value] value\r\n    1[name]  key2\r\n    1[value] value2\r\n    2[name]  dynamic_param\r\n    2[value] dynamic_param_value\r\n\r\nTo make sure there's nothing wrong with the form, calling the same from `$.ajax()` still formats the request params as expected:\r\n\r\n    key            value\r\n    key2           value2\r\n    dynamic_param  dynamic_param_value\r\n"},"comment":{"url":"https://api.github.com/repos/DataTables/DataTables/issues/comments/94023696","html_url":"https://github.com/DataTables/DataTables/issues/490#issuecomment-94023696","issue_url":"https://api.github.com/repos/DataTables/DataTables/issues/490","id":94023696,"user":{"login":"RipCurrent","id":8657359,"avatar_url":"https://avatars.githubusercontent.com/u/8657359?v=3","gravatar_id":"","url":"https://api.github.com/users/RipCurrent","html_url":"https://github.com/RipCurrent","followers_url":"https://api.github.com/users/RipCurrent/followers","following_url":"https://api.github.com/users/RipCurrent/following{/other_user}","gists_url":"https://api.github.com/users/RipCurrent/gists{/gist_id}","starred_url":"https://api.github.com/users/RipCurrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RipCurrent/subscriptions","organizations_url":"https://api.github.com/users/RipCurrent/orgs","repos_url":"https://api.github.com/users/RipCurrent/repos","events_url":"https://api.github.com/users/RipCurrent/events{/privacy}","received_events_url":"https://api.github.com/users/RipCurrent/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T16:40:07Z","updated_at":"2015-04-17T16:40:07Z","body":"Hi vol7ron,\r\nrunning into the exact same issue. Are you code as per Example#5 or did you find way to wrap form.serialize into format that can be used by DataTables?\r\nThanks for the detailed example code!!\r\n"}}