The URL is http://localhost:52974/App/Detail/23432. I know the following code can get the ID (23432) and it can be used in javascript code embedded in a cshtml file.
@ViewContext.RouteData.Values["id"]
However, I have an external jQuery script file which handle document.ready function. The following approach will not work because it's not a cshtml file. What's the best approach to get the MVC route ID value besides using javascript to parse the URL?
$(document).ready(function () {
var id = @ViewContext.RouteData.Values["id"];