var casualDays;
var days;
$(document).ready(function(){
$(function(){
$('select, input').styledSelect();
});
$(function (){
var usernameSelected = $("input#Employee_UserName" ).val().toString();
var username;
$.ajax({
url: '@Url.Action("GetLeaveConsumedDays", "ApplyLeave")',
type: 'POST',
data: { username: usernameSelected },
success: function (results) {
days=results;
},
error: function () {
alert("error");
}
});
});
$(function (){
var usernameSelected = $("input#Employee_UserName" ).val().toString();
var username;
$.ajax({
url:'@Url.Action("GetLeaveConsumedDaysCasual", "ApplyLeave")',
type: 'POST',
data: { username: usernameSelected },
success: function (results) {
casualDays=results;
},
error: function () {
alert("error");
}
});
});
K
this is my document.ready event, After run the page its work two or three time correctly.but after several times its not working properly.its not giving value for ‘days’ and ‘casualdays’ there value are get some error.After refreshing two or three time again its work.I cant think what is the reason for that.please any one can help me
Ajax is Asynchronous, you have to wait until the requests are complete before you can access
daysandcasualdays.