This is one of the interview question
For example :
Lets say there is a MVC application. In the View we have written a ajax method to call MVC controller
$("#SubmitCompany").click(function(){
var jqxhr = $.post( "\Company\Save", function() {
alert( "success" );
})
.done(function() {
alert( "second success" );
})
.fail(function() {
alert( "error" );
})
jqxhr.always(function() {
alert( "second finished" );
});
});
Where in Save method we have written a functionality to process the data and store it in database. We also return a bit whether it is successful or failed.
So the question is:
- What will happen if we initiate the request and close the browser after that?
- What will the output in this scenario (as per the Ajax call written)