diff options
author | Camil Staps | 2015-02-11 21:32:13 +0100 |
---|---|---|
committer | Camil Staps | 2015-02-11 21:32:13 +0100 |
commit | f9fd2bb54e2492d4654f5a6023023234b51a62fe (patch) | |
tree | 2c76e04cf0d67ea1b4fdbfa69cd6ea7480ddb224 /include/contacts-overview.php | |
parent | Offers can be added without reloading the page (diff) |
contacts can now be added without reloading the page
Diffstat (limited to 'include/contacts-overview.php')
-rw-r--r-- | include/contacts-overview.php | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/include/contacts-overview.php b/include/contacts-overview.php index 3fb1eb1..8548e3e 100644 --- a/include/contacts-overview.php +++ b/include/contacts-overview.php @@ -72,7 +72,7 @@ <div class="panel-heading">Create new</div> <div class="panel-body"> <form role="form" id="newContact" action='<?=constants::url_external?>contacts/new' method="post" class="bootstrapValidator ajaxify" - data-ajaxify-options='{"success":"newContactSuccess","error":"newContactError","beforeSubmit":"newContactBeforeSubmit","clearForm":true}'> + data-ajaxify-options='{"success":"newContactSuccess","error":"newContactError","beforeSubmit":"newContactBeforeSubmit"}'> <div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div> <div class="form-group"> <label>Client:</label> @@ -132,24 +132,16 @@ // Callback for when the form is successfully submitted function newContactSuccess(data) { - if (data.success == true) { - $('#newContact .ajaxify-response') - .addClass('alert-success') - .show() - .find('.ajaxify-response-text') - .html(data.message); - - $('#newContact input, #newContact button').prop('disabled', false); - $('#newContact').data('bootstrapValidator').resetForm(); - } else { - $('#newContact .ajaxify-response') - .addClass('alert-danger') - .show() - .find('.ajaxify-response-text') - .html(data.message); + $('#newContact .ajaxify-response') + .addClass(data.success ? 'alert-success' : 'alert-danger') + .show() + .find('.ajaxify-response-text') + .html(data.message); - $('#newContact input, #newContact button').prop('disabled', false); - $('#newContact').data('bootstrapValidator').resetForm(); + $('#newContact input, #newContact button').prop('disabled', false); + $('#newContact').data('bootstrapValidator').resetForm(); + if (data.success) { + $('#newContact input').val(''); } } |