MSUK1 Posted May 19, 2012 Share Posted May 19, 2012 I have a form that submits to a page when the user presses the submit button i want the form to wait 3 seconds before submitting (in this 3 seconds a div will slideup using jquery then the form will submit after the nice fancy removal of the div this is probably the wrong way to go about it? but its all i can think? Quote Link to comment https://forums.phpfreaks.com/topic/262756-not-sure-if-this-is-can-be-done-php-based/ Share on other sites More sharing options...
mbrown Posted May 19, 2012 Share Posted May 19, 2012 What will the div have in it? The div that is using jquery? or is this going to be more like a progression bar? Quote Link to comment https://forums.phpfreaks.com/topic/262756-not-sure-if-this-is-can-be-done-php-based/#findComment-1346744 Share on other sites More sharing options...
trq Posted May 19, 2012 Share Posted May 19, 2012 I don't see how this relates to php at all. You already said your using jQuery. Quote Link to comment https://forums.phpfreaks.com/topic/262756-not-sure-if-this-is-can-be-done-php-based/#findComment-1346746 Share on other sites More sharing options...
MSUK1 Posted May 19, 2012 Author Share Posted May 19, 2012 i completely re-thought about what i wanted- apologies I used AJAX to process the form to a php page. and as soon as the form was successfully completed the form in the div should hide. Tested and working this is my code: is the formatting okay? I don't see how this relates to php at all. You already said your using jQuery. It related to php because i wanted to process the php form using ajax <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>EU Cookie Plugin</title> <style> div.divvy {width:100%;height:auto;border-bottom:#000;background-color:#333;color:#fff;padding:10px;text-align:center;top:0px;} </style> </head> <body style="padding:0px; margin:0px;"> <? if (!isset($_COOKIE["EURegulationsMSUK"])) { ?> <div id="note" class="divvy"> <form name="setform" method="post" action="setcookie.php"> <input type="button" id="EUclose" class="button" name="set" value="on" /> </form> </div> <script> $(".button").click(function() { var set = $("input#EUclose").val(); var dataString = 'set='+ set; $.ajax({ type: "POST", url: "setcookie.php", data: dataString, success: function() { $('#note').slideUp(400,function () { $('#note').remove(); }); } }); return false; }); </script> <? } ?> <div> <?php if (isset($_COOKIE["EURegulationsMSUK"])) echo "Cookie Permission " . $_COOKIE["EURegulationsMSUK"] . "!<br />"; else if(!isset($_COOKIE["EURegulationsMSUK"])) echo "Cookie Permission off"; else echo "Error no cookie Set"; ?> <br /> <p style="display:inline;">Switch off Cookie</p> <form style="display:inline;" name="setform" method="post" action="setcookie.php"> <button name="set" type="submit" value="off">Off</button> </form> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/262756-not-sure-if-this-is-can-be-done-php-based/#findComment-1346747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.