jQuery - Illegal invocation
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.