Specify explicit form element
This allows request elements external to the form to serialize a target form for use. An example might be a search form at the top of a page, list of results in the middle, then the pagination at the bottom. The pagination would need to target the search form with data-request-form to persist the search query value. This should work with the JS API too, passed as an object, because $($()) is acceptable in jQuery
This commit is contained in:
parent
6697e00649
commit
b6fedfb688
|
|
@ -32,7 +32,7 @@ if (window.jQuery.request !== undefined) {
|
||||||
/*
|
/*
|
||||||
* Prepare the options and execute the request
|
* Prepare the options and execute the request
|
||||||
*/
|
*/
|
||||||
var $form = $el.closest('form'),
|
var $form = options.form ? $(options.form) : $el.closest('form'),
|
||||||
$triggerEl = !!$form.length ? $form : $el,
|
$triggerEl = !!$form.length ? $form : $el,
|
||||||
context = { handler: handler, options: options }
|
context = { handler: handler, options: options }
|
||||||
|
|
||||||
|
|
@ -377,6 +377,7 @@ if (window.jQuery.request !== undefined) {
|
||||||
redirect: $this.data('request-redirect'),
|
redirect: $this.data('request-redirect'),
|
||||||
loading: $this.data('request-loading'),
|
loading: $this.data('request-loading'),
|
||||||
flash: $this.data('request-flash'),
|
flash: $this.data('request-flash'),
|
||||||
|
form: $this.data('request-form'),
|
||||||
update: paramToObj('data-request-update', $this.data('request-update')),
|
update: paramToObj('data-request-update', $this.data('request-update')),
|
||||||
data: paramToObj('data-request-data', $this.data('request-data'))
|
data: paramToObj('data-request-data', $this.data('request-data'))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue