summaryrefslogtreecommitdiff
path: root/swat/scripting/client
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-10 07:03:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:34 -0500
commitd3751c45258a1fac9eb2117fcc67bab0159b730c (patch)
tree5a98697f54e3b878ca88b830dd0948a5392512fe /swat/scripting/client
parent8942ac69f01acc2e09a56e6accef6034622d40d4 (diff)
downloadsamba-d3751c45258a1fac9eb2117fcc67bab0159b730c.tar.gz
samba-d3751c45258a1fac9eb2117fcc67bab0159b730c.tar.bz2
samba-d3751c45258a1fac9eb2117fcc67bab0159b730c.zip
r9228: cleanup and simplify the AJAJ code - part 2
(This used to be commit bb3ab2c47b098ed57af358c4f5c6ad4d4d26eb33)
Diffstat (limited to 'swat/scripting/client')
-rw-r--r--swat/scripting/client/call.js32
1 files changed, 26 insertions, 6 deletions
diff --git a/swat/scripting/client/call.js b/swat/scripting/client/call.js
index 3af6a5a876..2886471db2 100644
--- a/swat/scripting/client/call.js
+++ b/swat/scripting/client/call.js
@@ -48,7 +48,7 @@ function __http_object() {
The callback() function is called with the returned
object. 'callback' may be null.
*/
-function vserver_call(url, func, callback, args) {
+function vserver_call_url(url, func, callback, args) {
var args2 = new Object();
args2.length = args.length;
var i;
@@ -58,7 +58,7 @@ function vserver_call(url, func, callback, args) {
var req = __http_object();
req.open("POST", url, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- req.send("func=" + func + "&args=" + encodeObject(args2));
+ req.send("ajaj_func=" + func + "&ajaj_args=" + encodeObject(args2));
req.onreadystatechange = function() {
if (4 == req.readyState && callback != null) {
var o = decodeObject(req.responseText);
@@ -71,7 +71,7 @@ function vserver_call(url, func, callback, args) {
/*
usage:
- server_call(url, func, callback, ...);
+ server_call_url(url, func, callback, ...);
'func' is a function name to call on the server
any additional arguments are passed to func() on the server
@@ -79,14 +79,14 @@ function vserver_call(url, func, callback, args) {
The callback() function is called with the returned
object. 'callback' may be null.
*/
-function server_call(url, func, callback) {
+function server_call_url(url, func, callback) {
var args = new Object();
var i;
for (i=3;i<arguments.length;i++) {
args[i-3] = arguments[i];
}
args.length = i-3;
- vserver_call(url, func, callback, args);
+ vserver_call_url(url, func, callback, args);
}
@@ -94,5 +94,25 @@ function server_call(url, func, callback) {
call printf on the server
*/
function srv_printf() {
- vserver_call('/scripting/general_calls.esp', 'srv_printf', null, arguments);
+ vserver_call_url('/scripting/general_calls.esp', 'srv_printf', null, arguments);
+}
+
+/*
+ usage:
+
+ server_call(func, callback, ...);
+
+ 'func' is a function name to call on the server
+ any additional arguments are passed to func() on the server
+
+ The callback() function is called with the returned
+ object. 'callback' may be null.
+*/
+function server_call(func, callback) {
+ var args = new Array(arguments.length-2);
+ var i;
+ for (i=0;i<args.length;i++) {
+ args[i] = arguments[i+1];
+ }
+ vserver_call_url("@request.REQUEST_URI", func, callback, args);
}