-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
I've just spent yet another 30 minutes helping someone debug this.
The issue:
$.post( {url: '/foo', data: bar})
generates a post request not at all to /foo. The reason is of course that this is not the signature of the method. The correct signature is
$.post('/foo', bar)
The problem is that $.ajax does accept things in the former format and its oh so easy to forget which is which. (And of course it's jquery standard to allow configuration objects in most places.) Of course when you make the mistake, it is very difficult to figure out what is going on as it will still generate a post request, just to the current page with an [object Object] parameter making you question your sanity.
I must have spent days over the years debugging this and helping others debug it.
So, feature request: Can console.warn to hint at what might be going on?