Thanks Jan.
On Sep 12, 8:47 pm, "jot.be" <jan.beili...@gmail.com> wrote: > Hi, > > > > > > > > > > On Mon, Sep 12, 2011 at 4:57 AM, Noel Villamor <noe...@gmail.com> wrote: > > I have a button which does the following callback: > > > ajax('{{=URL('callback')}}',['btn1'],':eval');" > > > Then I have the following callback function in my controller: > > > def callback(): > > db(db.tbl.id==100).update(data='sampledata') > > jquery = ??? > > return jquery > > > I can use jquery = "alert('Lame table update message');" but it > > doesn't appear as good as the response.flash message. > > > 1) How do I emulate response.flash? > > In a controller: > > msg = T('Page updated') > return 'jQuery(".flash").html("' + msg + '")\ > .slideDown().delay(1000).slideUp();' > > > 2) How to determine if the db update is successful or not so I can > > flash the appropriate message. > > I am using a slightly modified version of the function ajax() in > web2py_ajax.js which provides an error handler: > > https://gist.github.com/1210855 > > Maybe you can adapt it to your needs or someone has another tip how to > achieve this with web2py :) > > Jan > > > > > > > > > Thanks!