Add parameters to callback functions
Status: Beta
Brought to you by:
jplush76
see reference request
https://sourceforge.net/forum/forum.php?thread_id=1746930&forum_id=558946
Logged In: YES
user_id=690970
Originator: NO
I don't know where you're at with this, but just a quick thought on it. Would this be easier to implement by passing in an array rather than an unknown amount of parameters?
e.g.
ajaxObj.call("action=xyz", callbackFunction, array("abc", 123, "xyz"));
function callbackFunction(resp, arg1, arg2, arg3)
{
alert(arg1); // would alert "abc"
alert(arg2); // would alert 123
alert(arg3); // would alert "xyz"
}
Logged In: YES
user_id=1491998
Originator: YES
I was thinking more along the lines of an object literal or an object so you can have named parameters.
var callback = {function: callbackFunction,
param1:"test"};
ajaxObj.call("action=xyz", callback);
Logged In: YES
user_id=690970
Originator: NO
Makes sense.
Would there be the possibility of adding an interface on the PHP side to specify which of the named variables are passed to the callback?