2
我使用http://terminal.jcubic.pl/來創建一個jQuery終端。如何從另一個函數更改JQuery終端提示?
我想在用戶成功登錄後更改提示。例如,我想從#改變提示符root @ mac:
我對jQuery有點新鮮。請幫忙。
//這是我如何創建我的終端
var terminal = $('#jq_terminal').terminal(function(command, term) {
term.echo("you just typed " + command);
}, {
login: f_login,
greetings: "You are authenticated",
prompt: '#',
name: 'shell',
onBlur: function() {
return false;
}
});
// Login
function f_login(user, password, callback) {
// make a soket.IO call here. SocketIO will call f_login_response
}
// Login Response here
function f_login_response(user, password, callback) {
// How do I change the terminal prompt here ?
// I tried
terminal.prompt = '$'; // Does not work
}