have the following implementation
$.ajax({
type: "POST",
url: "/Member/SaveMember",
data: $('form').serialize(),
success: refreshGrid()
how come the refreshGrid() method is being called first prior to calling the ajax call of /Member/SaveMember ? I thought the “success” will only be called after successfully calling the server method.
any helps?
You are setting up the ajax call with the result of calling your refreshGrid, not with refreshGrid as a reference. Remove the parenthesis to indicate that you do not want to call your method, but instead pass the method.
If you want to set up the call with new parameters you wrap it in a new function