Sie Ste

Sie Ste

  • NA
  • 196
  • 185.1k

ajax call to a static method

Aug 27 2016 9:47 AM
I am having a problem with an ajax call to a shared (static) vb.net function to obtain data from the database.
In a vb.net 2010 web form application, I needed to make a call from a javascript function to a shared (static) function to
obtain data from a sql server 2012 database. The first ajax call below is the original call and the second call is the one
I came up by copying the first call.
The problem is the first call always occurs before the second ajax call regardless of what I do with the code. There are cases when I
only want the second call to occur. By stepping through the code, I see that there is alot of jquery code that occurs.
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: document.location.pathname + "/GetStudentLetter",
data: "{ " + strData + " }",
dataType: "json",
success: function (data) {
LoadEditor(JSON.parse(data.d), milestone);
},
error: AjaxFailed
});
if (milestone == '999') {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: document.location.pathname + "/Gettattschyr",
data: "{ " + strData + " }",
dataType: "json",
success: function (data) {
successtest(eval(data));
},
error: AjaxFailed
});
}
}
function successtest(sletter) {
var sle = sletter
_txtattschyr = sletter.d
if (_txtattschyr > '1') {
alert('You have selected student(s) having more than one Entry for the current school year. ');
return
}
}
Thus would you tell me what you think is wrong and/or tell me how I can change the second ajax call to try to solve this issue?

Answers (8)