The first parameter of .terminal(...)
is either a url to your rpc-service (string
) or it is an object containing the commands you want to add (object
).
The json-rpc
implementation that is used does not need to be written in php
. The rpc
definitions are just a standardized way to provide a interface for remote procedure calls.
So if you don't want to use the rpc
you would do something like this:
function test1(name, password, callback)
{
console.log("ok");
if(name == "Derek")
{
callback("some token");
}
else
{
callback(false);
}
}
jQuery(document).ready(function($) {
$('body').terminal({}, {
login: test1,
greetings: "You are authenticated",
onBlur: function() {
// the height of the body is only 2 lines initialy
return false;
}
});
});
The callback
that is passed to the login function needs to be called, passing a token if login was successful, or false
if not.
Normally you would to authentication server side, because everything that is in the browsers is not save. But because i don't know what you want to do with jquery.terminal
i can't suggest you anything about this.