diff options
author | Guillermo Guerrero <wolf.fox1985@gmail.com> | 2016-09-18 21:40:46 +0300 |
---|---|---|
committer | Guillermo Guerrero <wolf.fox1985@gmail.com> | 2016-09-18 21:40:46 +0300 |
commit | e6a7e10161f6d1f3e3bc399194e0942ebcfedd41 (patch) | |
tree | 2ed0f4181c08606b736fed1e80b1ab27aaa0ddd2 /static | |
parent | 9a294ed8751bd98edcac7c82b9f510890a8c1294 (diff) |
Post contact form via ajax with jquery.
Diffstat (limited to 'static')
-rw-r--r-- | static/js/front.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/static/js/front.js b/static/js/front.js index 07980c1..0a9d274 100644 --- a/static/js/front.js +++ b/static/js/front.js @@ -17,9 +17,30 @@ $(function () { animations();
counters();
demo();
+ contactForm();
});
+//Ajax contact
+function contactForm() {
+ var form = $('.contact-form');
+ form.submit(function () {
+ $this = $(this);
+ $.post($(this).attr('action'),
+ $this.serialize(),
+ function(data) {
+ $this
+ .prev()
+ .text("Thank you for getting in touch! We appreciate you contacting us, we try to respond as soon as possible. Have a great day ahead!.")
+ .fadeIn()
+ .delay(3000)
+ .fadeOut();
+ }
+ ,'json');
+ return false;
+ });
+}
+
/* for demo purpose only - can be deleted */
function demo() {
@@ -41,7 +62,7 @@ function demo() { return false;
});
-
+
$("#layout").change(function () {
if ($(this).val() !== '') {
@@ -50,14 +71,14 @@ function demo() { $('body').removeClass('wide');
$('body').removeClass('boxed');
-
+
$('body').addClass(theme_layout);
$.cookie("theme_layout", theme_layout, {expires: 365, path: '/'});
}
return false;
- });
+ });
}
/* slider homepage */
|