Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Document</title>
  6.     <script  src="../assets/jquery-1.8.3.min.js"></script> 
  7. <script type="text/javascript">
  8. $(function() {
  9. $(".submit_button").click(function() {
  10.  
  11.  
  12. var textval = $("#xval").val();
  13. var x = 'xval='+ textval;
  14. var textcontent = $("#content").val();
  15. var y = 'content='+ textcontent;
  16.  
  17. // $("#flash").show();
  18. // $("#flash").fadeIn().html('<span class="load">Loading..</span>');
  19. $.ajax({
  20. type: "POST",
  21. url: "action.php",
  22. data: y,
  23. cache: true,
  24. success: function(html){
  25.  $("#show").after(html);
  26. document.getElementById('content').value='';
  27. document.getElementById('xval').value='';
  28. alert('Data Saved');
  29. // $("#flash").hide();
  30. // $("#xval").focus();
  31. // $("#content").focus();
  32. }  
  33. });
  34.  
  35. return false;
  36. });
  37. });
  38. </script>
  39. </head>
  40. <body>
  41. <div class="container">
  42. <div class="main">
  43. <form  method="post" name="form" action="">
  44. <textarea style="width:500px; font-size:14px; height:60px; font-weight:bold; resize:none;" name="content" id="content" ></textarea><br />
  45. <textarea style="width:500px; font-size:14px; height:60px; font-weight:bold; resize:none;" name="xval" id="xval" ></textarea><br />
  46. <input type="submit" value="Post" name="submit" class="submit_button"/>
  47. </form>
  48. </div>
  49. <div class="space"></div>
  50. <div id="flash"></div>
  51. <div id="show"></div>
  52. </div>
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement