Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
89
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="https://code.jquery.com/jquery-3.0.0.min.js"></script>
  2. <script type="text/javascript">
  3. function callbb(postID){
  4. $.ajax({
  5. type:'POST',
  6. url: 'http://localhost/w/wp-admin/admin.php?page=rssap-feeds&action=run&post=' + postID + '',
  7. success:function (){
  8. alert('You have made it - ' + postID + '')
  9. },
  10. progress: function(e) {
  11.  
  12. alert('Your process is going one! ' + e.lengthComputable)
  13. }
  14. });
  15. }
  16.  
  17. (function($, window, undefined) {
  18. //is onprogress supported by browser?
  19. var hasOnProgress = ("onprogress" in $.ajaxSettings.xhr());
  20.  
  21. //If not supported, do nothing
  22. if (!hasOnProgress) {
  23. return;
  24. }
  25.  
  26. //patch ajax settings to call a progress callback
  27. var oldXHR = $.ajaxSettings.xhr;
  28. $.ajaxSettings.xhr = function() {
  29. var xhr = oldXHR();
  30. if(xhr instanceof window.XMLHttpRequest) {
  31. xhr.addEventListener('progress', this.progress, false);
  32. }
  33.  
  34. if(xhr.upload) {
  35. xhr.upload.addEventListener('progress', this.progress, false);
  36. }
  37.  
  38. return xhr;
  39. };
  40. })(jQuery, window);
  41. </script>
  42.  
  43. <a title="Run" href="#" onclick="var postID = $(this).data('postId'); callbb(postID)" data-post-id="506">Run</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement