jQuery - Illegal invocation jQuery - Illegal invocation ajax ajax

jQuery - Illegal invocation


Try to set processData: false in ajax settings like this

$.ajax({    url : base_url+'index.php',    type: 'POST',    dataType: 'json',    data: data,    cache : false,    processData: false}).done(function(response) {    alert(response);});


I think you need to have strings as the data values. It's likely something internally within jQuery that isn't encoding/serializing correctly the To & From Objects.

Try:

var data = {    from : from.val(),    to : to.val(),    speed : speed};

Notice also on the lines:

$(from).css(...$(to).css(

You don't need the jQuery wrapper as To & From are already jQuery objects.


Just for the record it can also happen if you try to use undeclared variable in data like

var layout = {};$.ajax({  ...  data: {    layout: laoyut // notice misspelled variable name  },  ...});