• 18_08_20 jQuery 获取URL中的参数


    发出请求

    function loadInfoDetails(a, b, c, d, e, f, g) {
    	window.location.href = window.basePath + "ssss/xxxxx/jsp/yyyyy.jsp?a=" + a+ "&b=" + b+ "&c=" + c+ "&d=" + d+ "&e=" + e+ "&f=" + f
    			+ "&g=" + g;
    }
    

    获取并解析

    $(document).ready(function() {
    
                            var url = location.href;
    
    			var id;// 提取URL中的 id
    			var divName;
    			var typeName;
    			var typeDetailName;
    			var ftlURL;
    			var ftlDetailURL;
    
    			var arrStr = url.substring(url.indexOf("?") + 1).split("&");
    			for (var i = 0; i < arrStr.length; i++) {
    				var loc = arrStr[i].indexOf("id=");
    				if (loc != -1) {
    					id = arrStr[i].replace("id=", "").replace("?", "");
    				}
    
    				loc = arrStr[i].indexOf("divName=")
    				if (loc != -1) {
    					divName = arrStr[i].replace("divName=", "");
    				}
    
    				loc = arrStr[i].indexOf("typeName=")
    				if (loc != -1) {
    					typeName = arrStr[i].replace("typeName=", "");
    				}
    
    				loc = arrStr[i].indexOf("typeDetailName=")
    				if (loc != -1) {
    					typeDetailName = arrStr[i].replace("typeDetailName=", "");
    				}
    
    				loc = arrStr[i].indexOf("ftlURL=")
    				if (loc != -1) {
    					ftlURL = arrStr[i].replace("ftlURL=", "");
    				}
    
    				loc = arrStr[i].indexOf("ftlDetailURL=")
    				if (loc != -1) {
    					ftlDetailURL = arrStr[i].replace("ftlDetailURL=", "");
    				}
    			}
    }
    
  • 相关阅读:
    hdu 3440 House Man
    hdu 2018 母牛的故事
    poj 1639 Picnic Planning 度限制mst
    uva 10870
    矩阵快速幂 模板与简单讲解
    1118sync_binlog innodb_flush_log_at_trx_commit 浅析
    1117Mysql prepare预处理语句
    1116Xlinux初学习之正则表达式和通配符
    1111分析存储引擎
    1111MySQL配置参数详解
  • 原文地址:https://www.cnblogs.com/du1991/p/9506249.html
Copyright © 2020-2023  润新知