I’m using the jQuery form plugin and trying to figure out why I can’t use the find method within the success function.
$('#signup-form').ajaxForm({
beforeSubmit: function (arr, $form, options) {
$form.find("input[name=email]").css('width', '170');
$form.find("input[type=submit]").val('Subscribing...').attr('disabled', 'true');
},
target: "#signup-form-wrap",
dataType: 'json',
success: function (data, $form) {
$form.find("input[type=submit]").val('Go!').css('width', '200');
}
});
For some reason, I get this error:
Uncaught TypeError: Object success has no method 'find'
When I alert $form, it’s value is just the string ‘success’. It does work in beforeSubmit, however. What am I doing wrong?
According to the documentation the second parameter passed to the success-function is statusText, which sounds like what you are logging. These are the parameters passed to the success-function according to the documentation:
So I guess your success-function would be something like this: