1

The text in my input is: test

What I want to do is end up with the next result:

some url + var

http://google.com/test

function off(){
var visit = $('#visit').val();
window.location = (visit);
}

Something like that:

window.location = "http://google.com/(visit)";

But the var is not acceptable

1
  • 1
    concatenation?... Commented Apr 6, 2018 at 12:17

2 Answers 2

4
function off(){
    var visit = $('#visit').val();
    var url = "https://google.com/"
    window.location = url + visit;
}

Simple concatenation where url is what you want the URL to be and visit is whatever you're appending

Sign up to request clarification or add additional context in comments.

2 Comments

i just realised the answer is literally inside the question title... bahaha
Okay it's funny lol, if I knew it was all because of + ^^ thanks for the help!
2

Is that what you want?

window.location = "http://google.com/" + visit;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.