Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var getResponseFromSOA = function(filterObject, file,verb, callback) {
- createFilterString(filterObject, function(filterString) {// get the filter string
- if(jQuery) {// check the jQuery file is integrated or not
- var headers = {Authorization: COOKIES.readCookie("Authorization"),requestmode:"ACK_URL"};
- headers.isRender = file.isRender;
- if(file.inputDataHeaders)
- headers.inputData = file.inputDataHeaders;
- // Here i want to show be ajax call
- $progressBar.kendoProgressBarShow();
- jQuery.ajax({
- url: file.fileUrl + "/" + $securityComponent.cryptograghicFunctions.encryptor(filterString),
- type: verb,
- headers: headers,
- async: false,
- /* beforeSend: function() {
- $progressBar.kendoProgressBarShow();
- },*/
- error : function()
- {
- console.log("some error occured at getResponseFromSOA submitting the request");
- },
- success: function(responseDataFromRequestHandler) {
- console.log(responseDataFromRequestHandler);
- // again call because it is async mode form SOA team
- jQuery.ajax({
- url: responseDataFromRequestHandler.links[1].href,
- async: false,
- headers: {Authorization: COOKIES.readCookie("Authorization"),requestmode:"ACK_URL"},
- success: function(responseDataFromResponseHandler) {
- try {
- console.log(responseDataFromResponseHandler);
- if(callback) callback(responseDataFromResponseHandler.data);
- }catch(e) {
- console.log(responseDataFromResponseHandler);
- // printing the error message in the console window
- console.log("Error in the callback in data-transactor-js > getResponseFromSOA"
- + "n"
- + e.message);
- }
- },
- complete: function() {
- // Here i want to close the progressBar or last below it's commented mode
- $progressBar.kendoProgressBarHide();
- }
- });
- },
- complete: function() {
- // Here i want to close the progressBar or last below it's commented mode
- $progressBar.kendoProgressBarHide();
- }
- });
- // If it's not possible there then i want to close here.
- //$progressBar.kendoProgressBarHide();
- } else throw {message: "jQuery is not defined or jQuery file is not linked"};
- });
- };
- $progressBar = {
- kendoProgressBarShow : function() {
- if (jQuery) {
- kendo.ui.progress($("#progressBar"), true);
- } else {
- console.log("jQuery not found");
- }
- },
- kendoProgressBarHide : function() {
- if (jQuery) {
- kendo.ui.progress($("#progressBar"), false);
- } else {
- console.log("jQuery not found");
- }
- }
- };
- $('#clickfun').click(function() {
- $(this).after('<div id="loading">Loading...</div>');
- for(var i=0;i<5;i++){
- setTimeout(function() {
- $.ajax({
- url: '/echo/html/',
- type: 'post',
- async: false,
- data: {
- html: '<p>Hello Friends</p>'+i,
- },
- success: function(data) {
- console.log(data);
- $('#clickfun').after(data + i);
- },
- error: function() {
- alert('Error found');
- },
- complete: function() {
- $('#loading').remove();
- }
- });
- }, 0);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement