下記コードでURLパラメーターをデコードしたいのですが、うまくいきません。。
js
1jQuery(function ($) { 2 3 let urlParamStr = location.search; 4 console.log(urlParamStr); 5// => ?id=%83e%83X%83g%8E%91%8D%DE03%201 6 7 urlParamStr = decodeURI(urlParamStr) 8 console.log(urlParamStr) 9 10 11}); 12
エラー内容
user_form.js:5 Uncaught URIError: URI malformed at decodeURI (<anonymous>) at HTMLDocument.<anonymous> (user_form.js:5) at j (jquery.js:2) at Object.fireWith [as resolveWith] (jquery.js:2) at Function.ready (jquery.js:2) at HTMLDocument.K (jquery.js:2)
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/04/27 06:43