php - How to open a smoothbox iFrame popup, on button cick,for a dynamic url -


we can open smoothbox popup link static url this

<a  id ="join-request" href="<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true" class="smoothbox"> click me  </a> 

but how can in button click ?

chek this demo

if buttons different url php use this:

html

<button class="smoothbox" url="one<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true">click me - one</button> <button class="smoothbox" url='two<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true'>click me - two</button> 

script

window.addevent("domready", function (e) {     document.getelements(".smoothbox").addevent("click", function (e) {         $('test_result').innerhtml = e.target.innerhtml + '</br >url is: ' + e.target.getproperty('url');         var url = e.target.getproperty('url');         window.open(url, '_blank'); //or smoothbox     }); }); 

if php gives same url can echo in script instead of inside buttons,

var url ='<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true' 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -