What is the order of execution for the below sample code? Will $(window).on('load', function () { })
be executed before completing $(document).ready(function () { });
.
I need to change all the text field values to uppercase after loading values form server through AJAX call. This page has more than twenty fields.
//Sample Code
$(window).on('load', function () {
//Some Code... to change all text field values to uppercase
alert("Window Loaded");
});
$(document).ready(function () {
//Some Code....
$.ajax({
url: "TestLoadOne",
type: "POST",
async: false,
contentType: 'application/text; charset=utf-8',
success: function (data) {
console.log('async false Ajax');
}
});
$.ajax({
url: "TestLoadOne",
type: "POST",
async: true,
contentType: 'application/text; charset=utf-8',
success: function (data) {
console.log('async false Ajax');
}
});
$.ajax({
url: "TestLoadOne",
type: "POST",
async: true,
contentType: 'application/text; charset=utf-8',
success: function (data) {
console.log('async false Ajax');
}
});
alert("Document Loaded");
});
//C# Code.
public string TestLoadOne()
{
System.Threading.Thread.Sleep(40000);
return "Hello";
}