使用url数据在页面加载时加载jQuery弹出窗口?

使用url数据在页面加载时加载jQuery弹出窗口?

问题描述:

Alright, just in case my title isn't good enough. I have my jQuery popup which works if someone clicks the link on the page. However, if I sent a link to a users email (an unsubscribe link), can I open that popup on page load only in that instance? I don't want the popup to load every time the page loads...only when the GET=gogo

I was thinking something like this:

The Email Link: www.someurl.com/index.php?unsubscribe=gogo

$code = $_GET['unsubscribe'];
if ($code) {
   //load jQuery popup
}

Could something like this work?

好的,以防我的标题不够好。 如果有人点击页面上的链接,我有我的jQuery弹出窗口。 但是,如果我发送了一个用户电子邮件的链接(取消订阅链接),我是否可以仅在该实例中打开该页面加载的弹出窗口? 我不希望每次页面加载时加载弹出窗口...只有当GET = gogo p>

我才想到这样的事情: p> 电子邮件链接: strong> www.someurl.com/index.php?unsubscribe = gogo p>

  $ code = $ _GET ['unsubscribe'  ]; 
if($ code){
 // load jQuery popup 
} 
  code>  pre> 
 
 

这样的事情可以吗? p> DIV>

You could simple attach a click event to your selector, something along these lines

var thisHash = window.location.hash;
if(window.location.hash) {
    $(thisHash).trigger('click');      
}

this uses hashes instead of get post data

so your url would look something like this

http://domain.com/#unsubscribe