Get escaped URL parameter

后端 未结 19 2708
小蘑菇
小蘑菇 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 14:11
    $.urlParam = function(name){
      var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(top.window.location.href); 
      return (results !== null) ? results[1] : 0;
    }
    
    $.urlParam("key");
    
    0 讨论(0)
提交回复
热议问题