Skip to content

Commit

Permalink
Makes ajaxSubmit with target compatible with jQuery>=1.12.1
Browse files Browse the repository at this point in the history
fixes #495
  • Loading branch information
kevindb committed Mar 19, 2017
1 parent f3e4efa commit 91ab636
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/jquery.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,13 @@
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};

callbacks.push(function(data) {
var fn = options.replaceTarget ? 'replaceWith' : 'html';
callbacks.push(function(data, textStatus, jqXHR) {
var successArguments = arguments,
fn = options.replaceTarget ? 'replaceWith' : 'html';

$(options.target)[fn](data).each(oldSuccess, arguments);
$(options.target)[fn](data).each(function(){
oldSuccess.apply(this, successArguments);
});
});

} else if (options.success) {
Expand Down

0 comments on commit 91ab636

Please sign in to comment.