Get escaped URL parameter

后端 未结 19 2680
小蘑菇
小蘑菇 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:56

    I created a simple function to get URL parameter in JavaScript from a URL like this:

    .....58e/web/viewer.html?page=*17*&getinfo=33
    
    
    function buildLinkb(param) {
        var val = document.URL;
        var url = val.substr(val.indexOf(param))  
        var n=parseInt(url.replace(param+"=",""));
        alert(n+1); 
    }
    buildLinkb("page");
    

    OUTPUT: 18

提交回复
热议问题