URLSearchParams & GET Query String & JSON

https://developer.mozilla.org/zh-CN/docs/Web/API/URLSearchParams

http://m.beta.xgqfrms.xyz/ticket/ticket-purchase-notice.html?ts=1579229812&productId=562


window.location.search;
//"?ts=1579229812&productId=562" const searchParams = new URLSearchParams(window.location.search); searchParams.get("productId");
// "562"

bug (iOS 上的 webview 自动添加 timestamp 导致,URL 查询字符串,截取 id 错误)

query string 截取错误

/ticket/ticket-purchase-notice.html?ts=1579229812&productId=562

// Bad js

    init() {
const spuId = window.location.search.slice(11);
// this.$router.query
// log(`spuId =`, window.location.search, this.$route);
this.fetchTemplate(spuId);
// this.datas = htmlData;
},

OK

/ticket/ticket-purchase-notice.html?productId=562


Webkit Webview

猜测 iOS 在 内嵌webview页面时,url后面加了时间戳是因为这个吧️?


Hash

http://lc.op.beta.xgqfrms.xyz:3010/#/activity-zwy-spu/89815?xxxx=yyy

        // const searchParams = new URLSearchParams(window.location.search);
// searchParams.get("productId");
// hash: "#/activity-zwy-spu/71364"
const spuId = this.activityId || window.parent.location.hash.slice(19) || ``;

refs



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


URLSearchParams & GET Query String & JSON的更多相关文章

  1. nodejs笔记三--url处理、Query String;

    URL--该模块包含用以 URL 解析的实用函数. 使用 require('url') 来调用该模块. 一.parse函数的基础用法 parse函数的作用是解析url,返回一个json格式的数组,请看 ...

  2. query string parameters 、 Form Data 、 Request Payload

    微信小程序ajax向后台传递参数的时候总是报400错误 然后看了一下network 发现是query string parameters,但是我写的header如下 header:{ "Co ...

  3. http 请求参数之Query String Parameters、Form Data、Request Payload

    Query String Parameters 当发起一次GET请求时,参数会以url string的形式进行传递.即?后的字符串则为其请求参数,并以&作为分隔符. 如下http请求报文头: ...

  4. HTTP请求中的form data,request payload,query string parameters以及在node服务器中如何接收这些参数

    http://www.cnblogs.com/hsp-blog/p/5919877.html 今天,在工作(倒腾微信小程序)的时候,发现发送post请求到node后台服务器接收不到前端传来的参数.其实 ...

  5. body传参?parameter传参?Request Payload?Query String Parameter?

    今天,是有委屈的一天:今天,是有小情绪的一天.所以,我们要对今天进行小结,跟它做一个了断! 今天,后端来一个接口,告诉我"要用post请求,parameter形式传参".over. ...

  6. Reading query string values in JavaScript

    时间 2016-01-23 13:01:14  CrocoDillon’s Blog 原文  http://crocodillon.com/blog/reading-query-string-valu ...

  7. elasticsearch 基础 —— Query String

    使用查询解析器来解析其内容的查询.下面是一个例子: GET /_search { "query": { "query_string" : { "def ...

  8. convert URL Query String to Object All In One

    convert URL Query String to Object All In One URL / query string / paramas query string to object le ...

  9. How to get the query string by javascript?

    http://techfunda.com/Tools/XmlToJson http://beautifytools.com/xml-to-json-converter.php https://www. ...

随机推荐

  1. Java 执行过程中的内存模型

    一.前言 本文的主要工作:尝试以时间顺序追踪一遍 Java 执行的整个过程,以及展示 JVM 中内存模型的相应变化. 本文的主要目的:希望能够通过 Java 执行过程的冰山一角,增进对编程语言工作原理 ...

  2. [每日电路图] 12、带自动烧写能力的 ESP8266 开发板制作

    目录 前言 1.芯片先关信息 2.原理图介绍 2.1 供电电路 2.2 串口电路 2.3 自动烧写电路 3.PCB 效果展示 附录 前言 ESP8266 是乐鑫公司面向物联网应用的高性价比.高度集成的 ...

  3. shell脚本的使用该熟练起来了,你说呢?(篇一)

    作者:良知犹存 转载授权以及围观:欢迎添加微信公众号:羽林君

  4. Codeforces Round #677 (Div. 3)【ABCDE】

    比赛链接:https://codeforces.com/contest/1433 A. Boring Apartments 题解 模拟即可. 代码 #include <bits/stdc++.h ...

  5. P4718 [模板]Pollard-Rho算法

    对一个大质数进行质因数分解 需要引用miller-robin来判素数 一直写的gcd居然挂掉了... 以后用__gcd了 #include <bits/stdc++.h> using na ...

  6. BZOJ4668: 冷战 (并查集 + LCA)

    题意:动态给点连边 询问两个点之间最早是在第几个操作连起来的 题解:因为并查集按秩合并 秩最高是logn的 所以我们可以考虑把秩看作深度 跑LCA #include <bits/stdc++.h ...

  7. Educational Codeforces Round 89 (Rated for Div. 2) C. Palindromic Paths(贪心)

    题目链接:https://codeforces.com/contest/1366/problem/C 题意 有一个 $n \times m$ 的 $01$迷宫,要使从 $(1,1)$ 到 $(n,m) ...

  8. Codeforces Round #647 (Div. 2) C. Johnny and Another Rating Drop(数学)

    题目链接:https://codeforces.com/contest/1362/problem/C 题意 计算从 $0$ 到 $n$ 相邻的数二进制下共有多少位不同,考虑二进制下的前导 $0$ .( ...

  9. zjnu1735BOB (单调队列,单调栈)

    Description Little Bob is a famous builder. He bought land and wants to build a house. Unfortunately ...

  10. 找新朋友 HDU - 1286 欧拉函数模板题

    题意: 求出来区间[1,n]内与n互质的数的数量 题解: 典型的欧拉函数应用,具体见这里:Relatives POJ - 2407 欧拉函数 代码: 1 #include<stdio.h> ...