How to concatenate this js

Asked

Viewed 32 times

1

??? How to concatenate this js, not getting it from error

 success:function(res) {
            secreto = res.lat;
            secreto2= res.lon;
            cidade = res.city;
            Pais  = res.country;

window.location.href = "secreto.php?lat='+secreto+'&long='+secreto2";

}

Not getting it for you

1 answer

2

It’s simple, you use either single quotes or double quotes:

window.location.href = "secreto.php?lat=" + secreto + "&long=" + secreto2;

There are cases where you need quotes (single or double) in the result, so yes you use one inside the other.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.