Pass array of data to jQuery function
Posted
by ILMV
on Stack Overflow
See other posts from Stack Overflow
or by ILMV
Published on 2010-03-22T10:01:30Z
Indexed on
2010/03/22
10:11 UTC
Read the original article
Hit count: 433
Here's the story... I have a jQuery function that does something, this function is referenced very regularly. One of the input parameters is an array, this array data is hard coded and thus I want to pass the data like this: (this is how I would do it using PHP)
myFunction(Array("1"=>"a","2"=>"b","3"=>"c"));
Instead of
$arr=Array("1"=>"a","2"=>"b","3"=>"c");
myFunction($arr);
So how do I achieve this with my jQuery function, I want this to be a one liner if possible.
© Stack Overflow or respective owner