MultiJson::DecodeError while send ajax request in Rails
ajax, jquery, ruby-on-rails
Solution
I have found the solution. It's worked now (see Content-Type):
$.ajax({
headers: {'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'), 'Content-Type': 'application/x-www-form-urlencoded'},
url:'/monitoring',
type:'POST',
data: {checked:{a:1}},
dataType: 'json',
success: function(){
}
});
Problem
I have the following code: ``` $.ajax({ headers: {'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'), 'Content-Type': 'application/json; charset=utf-8'}, url:'/monitoring', type:'POST', data: {checked:{a:1}}, dataType: 'json', success: function(){ } }); ``` The following exception has thrown when I send this request: MultiJson::DecodeError unexpected token at 'checked%5Ba%5D=1' What is this?