0

I use the loader of jquery mobile for all my ajax queries, but in only one case, i would like the loader to be hidden.

Is there a way to do it ?

1
  • add a parameter to your ajax call and check if true then only call code to display loading in the before send... Commented Aug 3, 2015 at 5:19

1 Answer 1

1
function getData (urlPath, showLoading) {
    $.ajax({
        url : urlPath,
        dataType: 'script',
        beforeSend : function(xhr, opts){
            if(showLoading) 
            {
               //call loading code
            }
        },
        success: function(data) {
            //success logic here
        },
        error: function(xhr, status) {
            // error handling here
        },
        complete: function(){
            console.log('DONE');
            if (showLoading)
            {
                //stop the display of loading in complete method
            }
        }
    });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.