Prepared token support for form widget.

This commit is contained in:
Martin Edenhofer 2017-03-22 03:37:19 +01:00
parent 14c1407448
commit 307f8cdb5a

View file

@ -148,6 +148,7 @@ $(function() {
} }
this._config = {} this._config = {}
this._token = ''
this.init() this.init()
} }
@ -263,6 +264,9 @@ $(function() {
$.each(data.errors, function( key, value ) { $.each(data.errors, function( key, value ) {
_this.$form.find('[name=' + key + ']').closest('.form-group').addClass('has-error') _this.$form.find('[name=' + key + ']').closest('.form-group').addClass('has-error')
}) })
if (data.errors.token) {
alert(data.errors.token)
}
_this.$form.find('button').prop('disabled', false) _this.$form.find('button').prop('disabled', false)
return return
} }
@ -294,6 +298,7 @@ $(function() {
if (this.options.test) { if (this.options.test) {
formData.append('test', true) formData.append('test', true)
} }
formData.append('token', this._config.token)
_this.log('debug', 'formData', formData) _this.log('debug', 'formData', formData)
return formData return formData
} }