Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
  2. <link rel="stylesheet" href="scripts/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
  3. <script type="text/javascript" src="scripts/jquery.fancybox.pack.js?v=2.1.5"></script>
  4.  
  5. <script type="text/javascript">
  6. if(!jQuery.browser.mobile){
  7. jQuery(document).ready(function() {
  8. $(".fancybox").fancybox({
  9. 'width' : 920,
  10. 'minHeight' : 230,
  11. 'type' : 'iframe',
  12. 'padding': 20,
  13. 'href': 'success.php',
  14. });
  15. });
  16. }
  17. </script>
  18.  
  19. <form action="success.php" method="post" name="contact" id="contact">
  20. <input type="radio" class="checkbox" name="one" value="yes" title="Do you find yourself using drugs even when you don't want to?: Yes" />
  21. <label class="question">Do you find yourself using drugs even when you don't want to?</label>
  22. <input type="submit" name="Submit" id="submit" class="fancybox fancybox.iframe" />
  23. </form>
  24.  
  25. <?php
  26. if ($_POST['one']=="yes") { echo "Do you find yourself using drugs even when you don't want to?"; }
  27. ?>
  28.  
  29. <form action="success.php" method="post" name="contact" id="contact">
  30. <input type="radio" class="checkbox" name="one" value="yes" title="Do you find yourself using drugs even when you don't want to?: Yes" />
  31. <label class="question">Do you find yourself using drugs even when you don't want to?</label>
  32. <input type="submit" name="Submit" id="submit" class="fancybox fancybox.iframe" /><!-- this is useless here -->
  33. <a id="check" data-fancybox-type="ajax" href="success.php" id="check">Result</a>
  34. </form>
  35.  
  36. <script type="text/javascript">
  37. jQuery(document).ready(function() {
  38. $('#check').on("click", function (e) {
  39. e.preventDefault(); // avoids calling success.php from the link
  40. $.ajax({
  41. type: "POST",
  42. cache: false,
  43. url: this.href, // success.php
  44. data: $("#contact").serializeArray(), // all form fields
  45. success: function (data) {
  46. // on success, post returned data in fancybox
  47. $.fancybox(data, {
  48. // fancybox API options
  49. fitToView: false,
  50. openEffect: 'none',
  51. closeEffect: 'none'
  52. }); // fancybox
  53. } // success
  54. }); // ajax
  55. }); // on
  56. }); //ready
  57. </script>
  58.  
  59. $(document).ready(function(){
  60. $("#"+secc+"form").submit(function(){
  61. var formData = new FormData($(this)[0]);
  62. $.ajax({
  63. url: '../form/',
  64. type: 'POST',
  65. data: formData,
  66. async: false,
  67. success: function (data) {
  68. //history,go(-1);
  69. },
  70. cache: false,
  71. contentType: false,
  72. processData: false
  73. });
  74.  
  75. return false;
  76. });
  77. });
  78.  
  79. jQuery(document).ready(function() {
  80. $(".fancybox").fancybox({
  81. 'width' : 920,
  82. 'minHeight' : 230,
  83. 'type' : 'iframe',
  84. 'padding': 20,
  85. 'href': 'success.php',
  86. 'data': $("#contact").serializeArray(),//send all form fields
  87. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement