Get escaped URL parameter

后端 未结 19 2943
小蘑菇
小蘑菇 2020-11-21 13:41

I\'m looking for a jQuery plugin that can get URL parameters, and support this search string without outputting the JavaScript error: \"malformed URI sequence\". If there is

19条回答
  •  耶瑟儿~
    2020-11-21 13:57

    You can use the browser native location.search property:

    function getParameter(paramName) {
      var searchString = window.location.search.substring(1),
          i, val, params = searchString.split("&");
    
      for (i=0;i

    But there are some jQuery plugins that can help you:

    • query-object
    • getURLParam

提交回复
热议问题