This was a serious lack of understanding of the code of the code I was attempting to use.
var lastPart = url.substr(url.lastIndexOf('/') + 1);
I didnt realise that this was reading everything after the char '/'. After changing it to '=' it worked perfectly!
Sorry community!