Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript"
  4. src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  5. <link rel="stylesheet" type="text/css" media="all" href="style-modal.css">
  6. <link rel="stylesheet" type="text/css" media="all" href="fancybox/jquery.fancybox.css">
  7. <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script>
  8. <script type ="text/javascript" src="like2.js"></script>
  9.  
  10. <title></title>
  11. <script type="text/javascript">
  12.  
  13. $(document).ready(function() {
  14.  
  15. $(".load").load('show.php');
  16.  
  17. function validateEmail(email) {
  18. var reg = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9
  19. {1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
  20. return reg.test(email);
  21. }
  22.  
  23. $(".modalbox").fancybox();
  24.  
  25. $("#contact").submit(function() { return false; });
  26.  
  27. $("#send").on("click", function(){
  28. var emailval = $("#email").val();
  29. var commentid = $("#commentid").val();
  30. alert("clicked!");
  31.  
  32.  
  33. var mailvalid = validateEmail(emailval);
  34.  
  35. if(mailvalid == false) {
  36. $("#email").addClass("error");
  37. }
  38. else if(mailvalid == true){
  39. $("#email").removeClass("error");
  40. }
  41.  
  42. if(mailvalid == true) {
  43.  
  44. $("#send").replaceWith("<em>Sending...</em>");
  45.  
  46. $.ajax({
  47. type: 'POST',
  48. url: 'sendmessage.php',
  49. data: $("#contact").serialize(),
  50. success: function(data) {
  51. if(data == "true") {
  52.  
  53.  
  54. $("#contact").fadeOut("fast", function(){
  55. $(this).before("<p><strong>Success! Your feedback has been sent, thanks :)</strong
  56. </p>");
  57. setTimeout("$.fancybox.close()", 1000);
  58. });
  59. }
  60. }
  61. });
  62. }
  63. });
  64.  
  65.  
  66. });
  67.  
  68. </script>
  69. </head>
  70. <body>
  71.  
  72. <div class="load">
  73. </div>
  74.  
  75. </body>
  76. </html>
  77.  
  78. <?php
  79. include('connect.php');
  80.  
  81. echo '<div class="load">
  82.  
  83. <button class="modalbox" href="#inline">Click</button>
  84.  
  85. </div>
  86.  
  87. <div id="inline">
  88. <h3>Enter your email to receive updates</h3>
  89. <form id="contact" name="contact" action="#" method="post">
  90. <label for="email">Your E-mail</label>
  91. <input type="email" id="email" name="email" class="txt">
  92. <input type="hidden" id="commentid" name="commentid" value="5">
  93. <br>
  94. <button id="send">Send E-mail</button>
  95. </form>
  96. </div>
  97. </div>';
  98. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement