Today encountered in a page to get another page URL passed over the parameters, at first instinctively thought of using split ("?") Such a step-by-step decomposition of the required parameters.After thinking about it, there will certainly be a more
jquery has a lot of ways to get URL information, but using this plugin is pretty cool.Managed address in: Http://github.com/allmarkedup/jQuery-URL-Parser http://localhost:19090/home/index?id=1 var Source = $.url.attr ("source"); http:
Original address: http://www.cnblogs.com/xiaoxi/p/5695783.html1, directly the parameter of the form is written in the parameters of the controller corresponding method, applicable to the Get method submission, not for post mode submission. /**
Sometimes we need to get the URL of the current Web page, so that we can judge, generally we are through location.href to getJS get URL link string: location.href can intercept it to obtain the transmitted parameters, commonly used as follows:
Instance 1
The code is as follows
Copy Code
function getquerystring (name) {var reg = new RegExp ("(^|&)" + name + "= ([^&]*) (&|$)");var r = window.location.search.substr (1). Match (REG);if (R!= null)Return unescape (r[
JavaScript gets the URL parameter code instance:Sometimes you might need to get the parameter values in the URL, and here's a related code instance.The code is as follows:varUrl= "Www.softwhy.com/test.php?id=21&a=5"; if(Url.indexof ("?")! =-1){
Tag: The AAA and string htm sample gets the tostring www. AspAssume the full address of the current page is: Http://www.jbxue.com/aaa/bbb.aspx?id=5&name=kelliThe"/HTTP" is the protocol name"Www.jbxue.com" is the domain name"AAA" is the station name."
Window.location method can also take parameters such as Href,search, let us look at the URL to get the parameters of the method.URL: Uniform Resource Locator (Uniform Resource Locator, URL)The complete URL consists of the following
Take "http://www.cnblogs.com/wuxibolgs329/p/6188619.html#flag?test=12345" as an example, and then get the various components of it.1 . Get the full URL of the pagevar a=location.href; Console.log (a); //"http://www.cnblogs.com/wuxibolgs329/p/5261577.
ASP. NET and JS get URL and IP address
Httpcontext. Current. Request. url. tostring () is not reliable.
If the current URL isHttp: // localhost/search. aspx? User = http://csharp.xdowns.com & tag = % BC % Ca % F5
Obtained Through httpcontext.
JS get URL passing Parameters
Here is a javascript client solution for obtaining URL parameters with questring, equivalent to ASP's request. querystring, PHP's $ _ Get
Function:
Then, we can call this function to obtain the corresponding parameter
This article transferred from: http://blog.csdn.net/chendi1985/article/details/5291773Window.location method Get URLUniform Resource Locator (Uniform Resource Locator, URL)The complete URL consists of the following
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.