This jquery_modal_confirm_dialogue is working after many experiments.
When our visitors agree to our Terms of Use, they are redirected to the product page products.html
I desperately need to set a cookie.
– if they do not agree, when they attempt to visit products.html, this
is not visible and displays the modal dialogue again
Could you please give me a hint?
(jquery 1.3.2.min.js)
This is my jqmodal.js
function confirm(msg,callback) {
$('#confirm')
.jqmShow()
.find('p.jqmConfirmMsg')
.html(msg)
.end()
.find(':submit:visible')
.click(function(){
if(this.value == 'yes')
(typeof callback == 'string') ?
window.location.href = callback :
callback();
$('#confirm').jqmHide();
});
}
$().ready(function() {
$('#confirm').jqm({overlay: 88, modal: true, trigger: false});
// trigger a confirm whenever links of class alert are pressed.
$('a.confirm').click(function() {
confirm('About to visit: '+this.href+' !',this.href);
return false;
});
});// JavaScript Document
This is my index.html:
<a href="http://products.html/" class="confirm">Products</a>
<div class="jqmConfirm" id="confirm">
<div id="ex3b" class="jqmConfirmWindow">
<div class="jqmConfirmTitle clearfix">
<h1>Terms of Use</h1>
</div>
<div class="jqmConfirmContent">
<p class="jqmConfirmMsg"></p>
<p>Important legal information</p></div>
<input type="submit" value="Decline" />
<input type="submit" value="Proceed" />
</div>
</div>
It works, finally! I was missing the callback when the cookie exists and these tics ” around the value of the cookie. Here is how it looks like. Please, let me know if there is some obvious mistake. (many thanks for your support)