I have a small problem with a javascript variable that I cannot figure out.
I am trying to pass a variable to a Jquery function parameter but it doesn’t work.
Original code:
$(".bt-fs-dialog").fSelector({
max: 25,
excludeIds: [],
getStoredFriends: [],
closeOverlayClick: true,
});
Now I want to pass values to the getStoredFriends field.
The documentation says it should be added like this:
getStoredFriends: [12345678,5484545],
So this is what I do:
var testresponse = "193102451,731800273";
$(".bt-fs-dialog").fSelector({
max: 25,
excludeIds: [],
getStoredFriends: testresponse,
closeOverlayClick: true,
});
This doesn’t work. No values are added to the function. I also tried to pass the values as an array:
var testresponse = new Array();
testresponse[0] = "193102451";
testresponse[1] = "731800273";
$(".bt-fs-dialog").fSelector({
max: 25,
excludeIds: [],
getStoredFriends: testreponse,
closeOverlayClick: true,
});
This also doesn’t work.
Can anyone explain how I can pass the values to this function?
Thanks in advance!
[12345678,5484545]is an array of numbers, so that’s probably what expects this function.Try with