我正在尝试初始化一些jQuery,只有在找到特定的查询字符串时才会运行。但是我在IF语句中匹配查询字符串时遇到问题。我的代码如下。
$(document).ready(function(){
if($(window.location.search == '?uploaded=success')){
alert('test has worked');
}
});
此if语句正在运行,无论是上传还是成功。 任何人都可以帮忙解释一下吗?
答案 0 :(得分:2)
if($(window.location.search == '?uploaded=success')){
应该是
if(window.location.search == '?uploaded=success'){
答案 1 :(得分:0)
if($(window.location.search == '?uploaded=success')){...!?
你的意思是:
if (window.location.search == '?uploaded=success')
或:
if ($(window.location.search) == '?uploaded=success') {