Does jQuery ajaxSetup method not work with $.get or $.post?
- by Justin Poliey
Does the jQuery $.ajaxSetup method not respect the data field in the options hash when $.post or $.get is called?
For example, I might have this code:
$.ajaxSetup({ data: { persist: true } });
Then, to send a POST request, I would call this:
$.post("/create/something", { name: "foo" });
I was expecting the actual POST data to look like this:
{
persist: true,
name: "foo"
}
but the only data sent by $.post is { name: "foo" }. Is there any way to get the expected behavior? I'm using jQuery 1.4.1.