Kuttan Sujith
Kuttan Sujith

Reputation: 7979

Do hyperlinks wait an Ajax action to complete?

I have a main page most of the part of the page is loaded as non-Ajax.

A portion of a page is loaded as Ajax action.

If I click any link on the non-Ajax section the on the site, the page is redirected to new page only after the Ajax action is completed.

How can I make the redirection happen with out completing the Ajax action

Upvotes: 0

Views: 76

Answers (3)

jishnu saha
jishnu saha

Reputation: 165

function redirect(callback){
$.ajax({
    data: {somedate},
    async:true,
    complete: function(){
        callback()
    }
 })
}

Upvotes: 0

ToibayevNariman
ToibayevNariman

Reputation: 41

Try use this method

function redirect(callback){
    $.ajax({
        data: {somedate},
        complete: function(){
            callback()
        }
    })
}

Upvotes: 0

Zeeshan Arif
Zeeshan Arif

Reputation: 499

you should use asynchronous ajax request, like this:

open(method,url,async)

the 'async' parameter specifies the request to be asynchronous or not, its a boolean parameter, set it to true like this:

open(method,url,true)

Upvotes: 1

Related Questions