Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

ajax call to shared (static) method

$
0
0
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?   


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>