小编Lud*_*ybo的帖子

JavaScript 获取查询字符串参数的值

我找不到任何拆分器解决方案 JS 来获取此 URL 中的一个参数 https://www.test.be/fr_BE/home/forms/test-test-salon.html?configId=f4q8s9z1&ucpBaseurl=https%253A%252F% 252Ftest.client.ucp.cloud&model=F56&motorization=柴油

我要隔离的部分是模型 id,model=F56,在这种情况下我想隔离“F56”

我试过这个脚本没有成功:

var srcID = "11111"; // Insert your src ID here
var typeID = "11111"; // Insert your type ID here
var category = "m1111"; // Insert your category value here
var axel = Math.random() + ""; var a = axel * 10000000000000;

// Grab Data Layer
var dataLayerApi = digital.tracking.getInstance(dataLayer);
var digitalData = dataLayerApi.getPageObject((window.minidtm.actPageId     !== undefined) ?  window.minidtm.actPageId  : dataLayerApi.getCurrentPageIndex());

var path = document.location.pathname;
var pathHirarchy = path.split("&");

if(path.match("\/fr_BE\/home\/forms\/.*\/.*") != …
Run Code Online (Sandbox Code Playgroud)

javascript url location split

1
推荐指数
1
解决办法
4494
查看次数

标签 统计

javascript ×1

location ×1

split ×1

url ×1