<script type="text/javascript">
function login() {
$.ajax({
url: 'http://127.0.0.1:8080/cgi-bin/luci/rpc/auth?auth=null',
data: JSON.stringify ({method:"login", params:["root", "foobar"]} ),
type:"POST",
dataType:"json",
success: function (result) {
alert("ok");
},
error: function (err,status,thrown) {
alert (" ERROR: " + err + " STATUS: " + status + " " + thrown );
}
})
}
$(document).ready(function() {
$("#foo").click(function() {
console.debug("loggin in..");
login();
});
});
</script>