1 (function ($) { 2 $.getUrlParam = function (name) { 3 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); 4 var r = window.location.search.substr(1).match(reg); 5 if (r != null) return decodeURIComponent(r[2]); 6 return null; 7 } 8 })(jQuery);
栗子:window.location.href="price.jsp?total="+sum+"&deviceId="+deviceId;
total = $.getUrlParam('total');
deviceId = $.getUrlParam('deviceId');