Updates to AJAX forms and adding autofill function to the event form when adding things via AJAX

This commit is contained in:
Tom Price
2014-12-03 11:17:07 +00:00
parent fbee8c9e9a
commit 91f6bb5557
8 changed files with 81 additions and 37 deletions

View File

@@ -138,9 +138,17 @@
jQuery(document).ready(function () {
jQuery(document).on('click', '.modal-href', function (e) {
e.preventDefault()
modaltarget = jQuery(this).data('target')
modalobject = "";
jQuery('#modal').load(jQuery(this).attr('href'), function (e) {
jQuery('#modal').modal();
});
jQuery('#modal').on('hide.bs.modal', function(e) {
if(modaltarget != "" && modalobject != "") {
jQuery(modaltarget).val(modalobject[0]['pk']);
jQuery(modaltarget+'-input').val(modalobject[0]['fields']['name']);
}
})
});
});
</script>