Get URL variables should be parsed. I created a jQuery document.location object and then used the attr function to get the search attribute to get all the variables. But when I use the split function on it, and after that each () is used, it gives an error stating that the object does not have a method each.
TypeError: Object [object Array] has no method 'each'
The code:
$(document.location).attr('search').split('&').each()
I also tried using the search property in the first function, but it does not allow this ie $ (document.location.search) gives an error.
I also checked that the data type of what is returned by the split function, the console says that it is an object, I am also confused that it should be an array.
PS: all the above code is included in the document.ready function from jQuery
source