From 2bf80570e893ca75a0201bb3ab2cc1f5af42e969 Mon Sep 17 00:00:00 2001 From: pavel Date: Tue, 9 Jun 2015 07:28:30 +0000 Subject: [PATCH] expo-186 ready --- static/seminar_lending/js/main.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/static/seminar_lending/js/main.js b/static/seminar_lending/js/main.js index 4439500a..f321fa88 100644 --- a/static/seminar_lending/js/main.js +++ b/static/seminar_lending/js/main.js @@ -16,16 +16,26 @@ $(document).ready(function () { }) $("form").on("submit", function(e){ e.preventDefault(); - var url = $(this).attr("action"), - form = $(this).serialize(); + var $this = $(this), + url = $this.attr("action"), + form = $this.serialize(), + $modalBody = $this.parent(), + $message = $("

"), + $button = $this.closest(".modal-dialog").find(".btn"); $.post( url, form, function(data){ console.log(data); + + if(data.message.length){ + $this.fadeOut("fast",function(){ + $button.fadeOut(); + $message.text(data.message).appendTo($modalBody); + }); + } } ); - console.log("!!!submit"); }) });