Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Passing a var to another func?

12:45 pm on Oct 16, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0

I've got this:

function foo (a) {
var bar = arguements[1];
new Ajax.Request('foo/bar/site',{
method: 'get',
onSuccess: function (r) {
if (bar) { ... }

Now, I can't for the life of me figure out how to get 'bar' within the onSuccess function to work. I hope that makes sense!

2:22 am on Oct 30, 2007 (gmt 0)

New User

10+ Year Member

joined:Oct 14, 2007
votes: 0

At a glance, I'd suggest this little edit:

instead of:
function foo (a) {
var bar = arguements[1];

do this:
function foo (a) {
var bar = arguments[0];

I assume "arguements" was a typo, but you definitely need to access the first value of the arguments, beginning with arguments[0]