So, this may be a really stupid question, but I'm obviously missing something here.
Consider the following code:
var selectedItems = [];
selectedItems.push("0ce49e98-a8aa-46ad-bc25-3a49d475e9d3");
//fyi, selectedItems[selectedItems.length] = "0ce49e98-a8aa-46ad-bc25-3a49d475e9d3"; produced the same result.
At the end selectedItems
content looks like this:
Name Value Type
------------- -------------------------------------- ------
selectedItems {...} Object
- [0] "0ce49e98-a8aa-46ad-bc25-3a49d475e9d3" String
- length 1 Long
But if I just try to call split() on the same string, like this:
selectedItems = "0ce49e98-a8aa-46ad-bc25-3a49d475e9d3".split(",")
Now the content of my supposed array looks like this (missing length):
Name Value Type
------------- -------------------------------------- ------
selectedItems {...} Object
- [0] "0ce49e98-a8aa-46ad-bc25-3a49d475e9d3" String
Any idea what the difference is? What's actually happening here?
Thanks in advance.
UPDATED: I have a feeling there's actually something structurally different about the two resulting values, because (atlas) ajax chokes on the one with the length property when I try to pass it to a server-side WebMethod (no actual error message, but I know the call fails). I'm not sure.
UPDATE #2 I noticed that setting the targetLocationIdList this way, results in no 'length' property being displayed in Quick Watch window:
var params =
{
jobId : args.get_JobId(),
targetLocationIdList : retVal.split(',')
};
But this results contain 'length' property displayed in Quick Watch window:
var retValArr = [];
retValArr = retVal.split(',');
var params =
{
jobId : args.get_JobId(),
targetLocationIdList : retValArr
};