Skip to content

Instantly share code, notes, and snippets.

@KatrinaHoffert
Created February 8, 2015 22:44
Show Gist options
  • Save KatrinaHoffert/1879ef766fdaae6c0937 to your computer and use it in GitHub Desktop.
Save KatrinaHoffert/1879ef766fdaae6c0937 to your computer and use it in GitHub Desktop.
Demoing reverse routing
<input id="locationId" type="hidden" value="123" />
<button id="submitButton">Submit</button>
<script>
$("#submitButton").on("click", function() {
// TODO: check if set, first, and handle case of not set
var locationId = $("#locationId").val();
var destUrl = jsRoutes.controllers.LocationController
.showLocation(locationId).url;
window.location(destUrl);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment