Is it possible to pass along variables in a JS confirm dialog? Right now, the variables are passing literally instead of their variable values being passed. In this case, the $id variable is not being passed:

<input type='button' onclick='confirmation()' value='Delete'>
At bottom of page, right above the closing </body> tag:

function confirmation() {
	var answer = confirm("Delete the information? This action cannot be undone.")
	if (answer){
		window.location = "delete.php?id=' . $id . '";
		window.location = "stay-on-same-page.php";
If I do it this way, with no alert, then the variables are passed just fine:

<a href='delete.php?id=" . $id . "'> Delete</a>
I like to use the confirm dialog to make sure someone hasn't clicked on the delete function accidentaly.