~/paste/1159
~/paste/1159
~/paste/1159

  1. <script type="text/javascript">
  2.   function login() {
  3.     $.ajax({
  4.       url: 'http://127.0.0.1:8080/cgi-bin/luci/rpc/auth?auth=null',
  5.       data: JSON.stringify ({method:"login", params:["root", "foobar"]} ),
  6.       type:"POST",
  7.       dataType:"json",
  8.       success: function (result) {
  9.         alert("ok");
  10.       },
  11.       error: function (err,status,thrown) {
  12.         alert (" ERROR: " + err + " STATUS: " + status + " " + thrown );
  13.       }
  14.     })
  15.   }
  16.  
  17.   $(document).ready(function() {
  18.       $("#foo").click(function() {
  19.           console.debug("loggin in..");
  20.           login();
  21.         });
  22.     });
  23. </script>
Language: text
Posted by Anonymous at 27 Jun 2012, 11:34:56 UTC