forked from mirror/Part-DB.Part-DB-server
Use ajax for form requests too.
This commit is contained in:
parent
b3db1dd139
commit
8711f296a4
6 changed files with 43 additions and 4 deletions
|
@ -75,6 +75,7 @@ class AjaxUI {
|
|||
{
|
||||
console.info("AjaxUI started!");
|
||||
this.registerLinks();
|
||||
this.registerForm();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,6 +96,26 @@ class AjaxUI {
|
|||
console.debug('Links registered!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all forms for loading via ajax.
|
||||
*/
|
||||
protected registerForm()
|
||||
{
|
||||
let options : JQueryFormOptions = {
|
||||
success: this.onAjaxComplete,
|
||||
beforeSubmit: function (arr, $form, options) : boolean {
|
||||
//When data-with-progbar is specified, then show progressbar.
|
||||
if($form.data("with-progbar") != undefined) {
|
||||
ajaxUI.showProgressBar();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$('form').not('[data-no-ajax]').ajaxForm(options);
|
||||
|
||||
console.debug('Forms registered!');
|
||||
}
|
||||
|
||||
|
||||
public showProgressBar()
|
||||
{
|
||||
|
@ -204,6 +225,7 @@ class AjaxUI {
|
|||
|
||||
//Do things on the new dom
|
||||
ajaxUI.registerLinks();
|
||||
ajaxUI.registerForm();
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue