javascript - how to execute a command after an ajax call? -


i wrote script

$.getjson('<%=url.action("jsonsave","controler")%>',             { id: newrow.id, personid: newrow.pesronid},              function(data) {                  $('#grid').trigger('reloadgrid'); //{0}                  $('#grid').editrow(rowcount); //{1}              }) 

what should {1} executed after {0}

answer updated did little research, , seems using jquery grid plugin. has callback called gridcomplete should need. combine original answer use one , set:

since events called in order, add method event queue this:

$.getjson('<%=url.action("jsonsave","controler")%>',         { id: newrow.id, personid: newrow.pesronid},          function(data) {             $('#grid').one('gridcomplete', function(){ $('#grid').editrow(rowcount); });             $('#grid').trigger('reloadgrid');          }) 

using one instead of bind causes event callback used once.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -