Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
- <script type="text/javascript">
- function callbb(postID){
- $.ajax({
- type:'POST',
- url: 'http://localhost/w/wp-admin/admin.php?page=rssap-feeds&action=run&post=' + postID + '',
- success:function (){
- alert('You have made it - ' + postID + '')
- },
- progress: function(e) {
- alert('Your process is going one! ' + e.lengthComputable)
- }
- });
- }
- (function($, window, undefined) {
- //is onprogress supported by browser?
- var hasOnProgress = ("onprogress" in $.ajaxSettings.xhr());
- //If not supported, do nothing
- if (!hasOnProgress) {
- return;
- }
- //patch ajax settings to call a progress callback
- var oldXHR = $.ajaxSettings.xhr;
- $.ajaxSettings.xhr = function() {
- var xhr = oldXHR();
- if(xhr instanceof window.XMLHttpRequest) {
- xhr.addEventListener('progress', this.progress, false);
- }
- if(xhr.upload) {
- xhr.upload.addEventListener('progress', this.progress, false);
- }
- return xhr;
- };
- })(jQuery, window);
- </script>
- <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