When working with the Telerik Grid, I am calling grid.submitchanges()(FUNCTION1) in JavaScript. This call is asynchronous and is followed by an ajax synchronous callback (FUNCTION2).
The issue arises when FUNCTION2 gets executed before FUNCTION1 is completed due to the asynchronous nature of FUNCTION1. However, my requirement is for FUNCTION2 to only execute after FUNCTION1 has finished.
Is there a way to receive a callback for the telerik grid submitChanges(FUNCTION1)? Alternatively, can the telerik grid submitChanges(FUNCTION1) be made a synchronous call?
Code-:
//FUNCTION 1
if (grid != undefined && grid.hasChanges()) {
grid.submitChanges();
}
//FUNCTION 2
$.ajax({
url: urlForTheController,
type: 'GET',
async: false,
cache: false,
data: { TotalConAssociation: noOfRows },
success: function (data) {
$('#AssociationWithDocument').data('tWindow').close();
showConcepts(currentConceptIndex);
},