gpt4 book ai didi

php - 通过 Javascript 中的 xmlHttpRequest 将查询字符串值发送到另一个 php 页面时,查询字符串值被 chop 吗?

转载 作者:行者123 更新时间:2023-11-28 16:03:58 24 4
gpt4 key购买 nike

我在表单中的 demoUrlName(文本字段 id)中传递这个 url 值例如,http://common360.info/browse.php?u=uushJYHAjQLTHh2twPpHjQMbEl4%3D&b=5&f=norefer

我使用 xmlHttpRequest 将此值重定向到另一页。问题是,在通过 xmlHttpRequest 和重定向页面发送表单值时,url 值被 chop 为 http://common360.info/browse.php?u=uushJYHAjQLTHh2twPpHjQMbEl4=

如何发送我在表单中输入的值。

我的代码是,

    var str = trim(document.getElementById('demoUrlName').value);
var str = "action=demo&url="+str+"&urlqstr="+urlqstr+"&pgesrc="+pgesrc+"&r="+ran_number;
var url = "demo/demoTool.php";
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.send(str);

最佳答案

使用the encodeURIComponent function& 编码为数据,而不是将它们用作“键/值对分隔符”

关于php - 通过 Javascript 中的 xmlHttpRequest 将查询字符串值发送到另一个 php 页面时,查询字符串值被 chop 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15814017/

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