Add the necessary Javascript to implement in place login functionality.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Tue, 18 Jan 2011 01:08:32 +0530
changeset 450 7984094bf6c4
parent 449 50c45258b00e
child 451 09a1ee04a3f4
Add the necessary Javascript to implement in place login functionality.
pytask/static/js/login.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/static/js/login.js	Tue Jan 18 01:08:32 2011 +0530
@@ -0,0 +1,18 @@
+var login_user = function (login_url) {
+  $(document).ready(function () {
+    $('#form_login').submit(function() {
+      $.post(
+        login_url,
+        $("#form_login").serialize(),
+        function (raw_data) {
+          data = $.parseJSON(raw_data);
+          alert(data);
+          if (data.authentication == "success") {
+            $("div#useraction").replaceWith(data.markup);
+            alert(data.markup);
+          }
+        });
+      return false;
+    });
+  });
+}
\ No newline at end of file