gpt4 book ai didi

javascript - 正在从全名 Aweber 中删除 %20

转载 作者:行者123 更新时间:2023-12-03 12:31:18 25 4
gpt4 key购买 nike

将变量从 Aweber 传递到 wordpress 感谢页面 - 但名称显示如下:名字%20姓氏

使用的代码

    <script type="text/javascript">
var formData = function() { var query_string = (location.search) ? ((location.search.indexOf('#') != -1) ? location.search.substring(1, location.search.indexOf('#')) : location.search.substring(1)) : '';
var elements = [];
if(query_string) {
var pairs = query_string.split("&");
for(i in pairs) {
if (typeof pairs[i] == 'string') {
var tmp = pairs[i].split("=");
var queryKey = unescape(tmp[0]);
queryKey = (queryKey.charAt(0) == 'c') ? queryKey.replace(/s/g, "_") : queryKey;
elements[queryKey] = unescape(tmp[1]);
}
}
}
return {
display: function(key) {
if(elements[key]) {
document.write(elements[key]);
}
else {
document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");
}
}
}
}
(); </script>

then
<script>// <![CDATA[
formData.display('fullname')
// ]]></script>

尝试过 解码URI(formData.display(“全名”))但不起作用???我搜索了又搜索但无法弄清楚 - 请有人帮忙吗???谢谢。

最佳答案

我猜它是 WordPress 插件的一部分,所以你只需要修复:)

尝试更换这部分:

return {  
display: function(key) {
if(elements[key]) {
document.write(elements[key]);
} else {
document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");
}
}
}

这样:

return {
display: function(key) {
if(elements[key]) {
document.write(decodeURIComponent(elements[key]));
} else {
document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");
}
}
}

关于javascript - 正在从全名 Aweber 中删除 %20,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23906915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com