Html 查询字符串-多个参数
我试图传递以下Html 查询字符串-多个参数,html,query-string,window.location,Html,Query String,Window.location,我试图传递以下查询字符串,但遇到网页不可用错误: window.location.href=“chaindeals.html?chainID=“+chainID+”&imageURL=“+imageURL 我还尝试将&更改为&但是我得到了同样的错误 有人知道我做错了什么吗 感谢您的帮助。请尝试提供window.location.href的完整url,而不仅仅是页面名称: var host = "http://" + window.location.host; window.location
查询字符串
,但遇到网页不可用
错误:
window.location.href=“chaindeals.html?chainID=“+chainID+”&imageURL=“+imageURL代码>
我还尝试将&
更改为&代码>但是我得到了同样的错误
有人知道我做错了什么吗
感谢您的帮助。请尝试提供window.location.href
的完整url,而不仅仅是页面名称:
var host = "http://" + window.location.host;
window.location.href =
host
+ "/chaindeals.html"
+ "?chainID=" + chainID
+ "&imageURL=" + imageURL;
尝试提供window.location.href
的完整url,而不仅仅是页面名称:
var host = "http://" + window.location.host;
window.location.href =
host
+ "/chaindeals.html"
+ "?chainID=" + chainID
+ "&imageURL=" + imageURL;
请试试这个。
var url = '';
url = url.concat('chaindeals.html?chainID=',chainID, '&imageURL=', imageURL);
window.location.href = url;
请试试这个。
var url = '';
url = url.concat('chaindeals.html?chainID=',chainID, '&imageURL=', imageURL);
window.location.href = url;
那么,值的串联会产生什么样的实际URL呢?浏览器(开发人员工具->网络面板)实际请求了什么?哪个浏览器出现此错误?您的脚本很好,能否确保文件名是否正确?变量chainID
为1
和ImageURL
为“http:\/\/www.8coupons.com\/stores\/chain\/logo\/big\/Dunkin\u Donuts\u 1224967687.png”
。当我只使用chainID
时,一切似乎都很好……这是错误消息的图片:那么,值的串联会产生什么实际URL?浏览器实际请求了什么(开发者工具->网络面板)?哪个浏览器出现此错误?您的脚本很好,您可以确定文件名是否正确吗?变量chainID
是1
,ImageURL
是“http:\/\/www.8coups.com\/stores\/chain\/logo\/big\/Dunkin\u Donuts\u 1224967687.png”“
。当我只使用chainID
时,一切似乎都正常工作……这是错误消息的图片: