oxjs/demos/test/app.js
2010-01-31 15:02:41 +05:30

42 lines
1.3 KiB
JavaScript

$(function() {
var app = new Ox.App({
requestURL: "http://blackbook.local:8000/api/"
}),
$dialog = new Ox.Dialog({
title: "Application Error",
buttons: [
{
value: "Change Title",
click: function() {
console.log("click to change title")
$dialog.options({
title: "New Title"
});
$dialog.$buttons[0].toggleDisabled();
}
},
{
value: "Close",
click: function() {
$dialog.close();
}
}
]
});
app.request("error");
//app.request("hello");
app.request("login", {"username": "test", "password": "test"}, function(result) {
Ox.print(result);
if (result.status.code == 200) {
Ox.print(result);
app.request("preferences", function(result) {
Ox.print(result.data.preferences);
});
}
else if (result.status.code == 403) {
alert(403);
//$dialog.open();
} else if (result.status.code == 500) {
}
});
});