This is what i use for opening google maps for a single stop :
$(document).on('click', 'button', function () {
const location = "Empire state building"
const location2 = "Washington square park"
var url = `https://www.google.com.sa/maps/search/${location}?hl=en`
window.open(url, '_blank');
});
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
</head>
<body>
<button>OPEN GOOGLE MAPS</button>
</body>
</html>
How could i include location2 in the url to make a multiple stop route?
You can add multiple stops via the following format:
https://www.google.com/maps/dir/${START}/${STOP1}/${STOP2}/${END}.
You can add as many stops as you want.