|
53 | 53 | this.element = element[0]; |
54 | 54 | this.$element = $(this.element); |
55 | 55 | var lateDefaults = { |
56 | | - reqParams: { |
57 | | - type : this.$element.attr('method'), |
58 | | - url : this.$element.attr('action') |
59 | | - }, |
60 | 56 | encType : (typeof this.$element.attr('enctype') !== 'undefined') ? this.$element.attr('enctype') : '', |
61 | 57 | msgTarget: this.$element.find('.js-form-alerts:first') |
62 | 58 | }; |
63 | 59 | this.settings = $.extend(true, {}, defaults, lateDefaults, options); |
64 | | - this._defaults = defaults; |
| 60 | + this._defaults = $.extend(true, {}, defaults, lateDefaults); |
65 | 61 | this._name = pluginName; |
66 | 62 |
|
67 | 63 | // Detect changes to element attributes |
|
90 | 86 | submitButton.html(this.settings.submittingText); |
91 | 87 | } |
92 | 88 |
|
| 89 | + // Get basic request parameters. |
| 90 | + var reqParams = { |
| 91 | + type: this.$element.attr('method'), |
| 92 | + url: this.$element.attr('action') |
| 93 | + }; |
| 94 | + |
93 | 95 | // Get the form encoding type from the users HTML, and chose an encoding form. |
94 | 96 | if (this.settings.encType.toLowerCase() === "multipart/form-data" ) { |
95 | | - this.settings.reqParams.data = this._multipartData(form); |
| 97 | + reqParams.data = this._multipartData(form); |
96 | 98 | // add additional params to fix jquery errors |
97 | | - this.settings.reqParams.cache = false; |
98 | | - this.settings.reqParams.contentType = false; |
99 | | - this.settings.reqParams.processData = false; |
| 99 | + reqParams.cache = false; |
| 100 | + reqParams.contentType = false; |
| 101 | + reqParams.processData = false; |
100 | 102 | } else { |
101 | | - this.settings.reqParams.data = this._urlencodeData(form); |
| 103 | + reqParams.data = this._urlencodeData(form); |
102 | 104 | } |
103 | 105 |
|
104 | 106 | // Submit the form via AJAX |
105 | | - $.ajax(this.settings.reqParams).then( |
| 107 | + $.ajax(reqParams).then( |
106 | 108 | // Submission successful |
107 | 109 | $.proxy(function(data, textStatus, jqXHR) { |
108 | 110 | // Restore button text and re-enable submit button |
|
0 commit comments