我可以使用
在URL中显示哈希var hash = location.hash.substr(1);
if (hash === "home") {
$(".pageContent").load("?embed&page=home");
}
如何检查网址中是否没有像!isset
这样的哈希?
答案 0 :(得分:1)
如何检查URL中是否没有像!isset这样的哈希?
if (window.location.hash) {
// Hash exists
} else {
// Hask doesn't exist
}
答案 1 :(得分:-2)
在这种情况下,哈希将为空字符串,因此:
if (hash == "")
您可以检查JS中与php'isset'相关的null和undefined:
if(hash == undefined)