jquery get url parameter and URL plus parameter method

Source: Internet
Author: User

Turn--http://www.jb51.net/article/73896.htm

<script src= "js/jquery-1.7.2.min.js" type= "text/javascript" ></script> <script type= "text/javascript" > $( function () { //方法二: ( function ($) { $.getUrlParam = function (name) { var reg = new RegExp( "(^|&)" + name + "=([^&]*)(&|$)" ); var r = window.location.search.substr(1).match(reg); if (r != null ) return unescape(r[2]); return null ; } })(jQuery); //方法二: var xx = $.getUrlParam( ‘reurl‘ ); //方法一: // var xx = getUrlParam(‘reurl‘); alert(xx); }); //方法一: //获取url中的参数 function getUrlParam(name) { var reg = new RegExp( "(^|&)" + name + "=([^&]*)(&|$)" ); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null ) returndecodeURI (r[2]); return null ; //返回参数值…………(有瑕疵,自己改!) } </script>

jquery get url parameter and URL plus parameter method

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.