Dinesh Bali
asked on
Load page once jQuery ajax call is executed.
HI,
I am working on .Net application using C#
I JQuery, I wanted that page should not render until my ajax function is not executed.
Please advise the solution
Code below:
I am working on .Net application using C#
I JQuery, I wanted that page should not render until my ajax function is not executed.
Please advise the solution
Code below:
$( window ).load(function() {
$.ajax({
url: '/der/surface/userHasSession',
data: { currURL: window.location.pathname + window.location.search },
type: 'GET',
xhrFields: { withCredentials: true },
accept: 'application/json',
async: false
}).done(function (userdata) {
console.log('Done');
})
.fail(function (jqXHR, textStatus, error) {
console.log('Session Check Fail: ');
})
}
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you need to move the jQuery and cookie plugins inside this script block too
ASKER
Really great.
It works fine.
Since it is taking time to load as too much processing on server for business rules.
Anyway we can put loader at the time of processing.
If you want I can raise another question for the resolution.
Please advise.
It works fine.
Since it is taking time to load as too much processing on server for business rules.
Anyway we can put loader at the time of processing.
If you want I can raise another question for the resolution.
Please advise.
ASKER
Added question here
https://www.experts-exchange.com/questions/29167954/Adding-loader-on-page.html
https://www.experts-exchange.com/questions/29167954/Adding-loader-on-page.html
ASKER
When I moved my script in body then I am getting error at below line. What is the reason?
$.cookie('VerifySSOLogin',
Error is:
jquery-2.1.4.min.js:2 Uncaught TypeError: $.cookie is not a function