could one use the beforeSend() and complete() handlers with $.post or do you have to use $.ajax for it?
+1
A:
You could use $.ajaxSetup but it will apply globally. If this doesn't fit you you should use $.ajax.
Darin Dimitrov
2010-02-13 15:07:46
+1
A:
Gotta use $.ajax, unless you use $.ajaxSetup(), but that may not be the wisest choice.
Any reason why you shouldn't use $.ajax?
Lior Cohen
2010-02-13 15:08:20
then i have to change all my $.post shortcuts to $.ajax. and they aren't few=)
weng
2010-02-14 14:51:04
+2
A:
You have 2 options, use $.ajax()
or $.ajaxSetup()
.
Using $.ajax():
$.ajax({
type: 'POST',
url: url,
data: data,
success: success
dataType: dataType
});
Or, before your post run $.ajaxSetup(), but this affects all ajax requests:
$.ajaxSetup({
beforeSend: myFunc,
complete: myCompleteFunc
});
Nick Craver
2010-02-13 15:08:37