Hoping someone can help me. I am using colorbox to pop open an <iframe> form when a user submits their zip code. There is one additional event I would like to happen only when a user attempts to close the iframe or hits back on their browser. In either of these events, I would like the parent page (the page under the iframe) to load a different page url. Currently the code I am using to pop open the iframe on zip code submit is the following:
<script>
function submitHandler(e) {
e.preventDefault();
var zip = $('#zip').val();
if (zip.length < 5) { alert("Please enter a valid zip code"); return false;};
//alert("keyword is " + keyword);
$.colorbox({href: "/ppc/form.htm?zip=" + zip, iframe:true, innerWidth:800, innerHeight:600});
}
$(document).ready(function() {
$('form#start').submit(function(e) {
submitHandler(e);
});
$("a[rel=zipformSubmit]").click(function(e) {
submitHandler(e);
});
});
1 Answer