You will need to split mySearch once again at (=
) for each name,value pair in order to retrieve the value.
Without rewriting anything.
This modification will work:
var mySearch = location.search.substr(1).split("&");
var myPicture = mySearch.split("=");
var myWords = mySearch.split("=");
var pictureFromSearch = myPicture;
var wordsFromSearch = myWords;
And; If you pass the value wrapped in quotes as below.
You will need to strip those out as well.