From 3a02c8b116e80d2fd70b1957a5ed85acb0977b7f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 5 Aug 2005 19:16:13 +0000 Subject: r9134: added the client side js library code for handling remote 'AJAJ' calls into our web server (This used to be commit 530717122a3c7e34258db8ed0bfd0cc00624b903) --- swat/scripting/client/call.js | 38 ++++++++++++++++++ swat/scripting/client/encoder.js | 84 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 swat/scripting/client/call.js create mode 100644 swat/scripting/client/encoder.js (limited to 'swat') diff --git a/swat/scripting/client/call.js b/swat/scripting/client/call.js new file mode 100644 index 0000000000..bb89390e45 --- /dev/null +++ b/swat/scripting/client/call.js @@ -0,0 +1,38 @@ +/* + client side js functions for remote calls into the server + + Copyright Andrew Tridgell 2005 + released under the GNU GPL Version 2 or later +*/ + + +/* + usage: + + server_call(url, 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(url, func, callback) { + var req = new XMLHttpRequest(); + req.open("POST", url, true); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + var args = new Object(); + var i; + for (i=3;i