0

My Javascript experience is limited, so I apologize in advance.

Essentially, what I'm trying to do is make a button that grabs a part of the current URL (user ID) and then sends the user to a new URL with the user ID in it.

So, let's say the current URL is this:

owl.uwo.ca/account/12345/webpage.html/?userid=[6789]

And I need to send the user to this:

completestudent.ca/account?userid=[6789]&resourceid=[JG56J]

Am I on the right track with this code?

function completeModule(){
    var pathArray = window.location.pathname.split( '/' );
    var userID = pathArray[4];
    var completeLink = "completestudent.ca/account"+userID+"&resourceid=[JG56J]";
    window.location.assign(completeLink)
}

Any help is much appreciated.

0 Answers0