拆分路径名以获取路由参数 [英] split path name to get routing parameter
本文介绍了拆分路径名以获取路由参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的应用程序中使用mvc和jquery我有这样的路由URL:
i am using mvc and jquery in my application i have the routing url like this :
ID/Controller/Action
我想获取URL并将其拆分以获取jquery中的id
I want to get the URL and split it to get the id in jquery
推荐答案
var pathname = window.location.pathname;
var appId = pathname.split('/')[1];
我看到你的第一个参数是这段代码的id你可以在jquery中得到id
i see that your first param is the id with this piece of code you can get the id in jquery
这篇关于拆分路径名以获取路由参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文