Guest User

Untitled

a guest
Jan 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <script src="jquery-1.2.3.min.js"></script>
  2. <script type="text/javascript"> var jQ = $.noConflict(true); </script>
  3. <script type="text/javascript">
  4. jQ(document).ready(function() {
  5.  
  6. jQ().ajaxStart(function() {
  7. jQ('#loading').show();
  8. jQ('#result').hide();
  9. }).ajaxStop(function() {
  10. jQ('#loading').hide();
  11. jQ('#result').fadeIn('slow');
  12. });
  13.  
  14. jQ('#frm').submit(function() {
  15. var formData = new FormData($(this)[0]);
  16. jQ.ajax({
  17. type: 'POST',
  18. url: jQ(this).attr('action'),
  19. data: jQ(this).serialize(),
  20. success: function(data) {
  21. jQ('#result').html(data);
  22. }
  23. })
  24. return false;
  25. });
  26. })
  27. </script>
  28.  
  29. $("form#data").submit(function(){
  30.  
  31. var formData = new FormData($(this)[0]);
  32.  
  33. $.ajax({
  34. url: window.location.pathname,
  35. type: 'POST',
  36. data: formData,
  37. async: false,
  38. success: function (data) {
  39. alert(data)
  40. },
  41. cache: false,
  42. contentType: false,
  43. processData: false
  44. });
  45.  
  46. return false;
  47. });
Add Comment
Please, Sign In to add comment