Hi Thadeus, Thanks for your input. Perhaps you could provide a couple of examples, as I'm a little confused.
In my example, I intended the function 'mark' to only return this: DIV(IMG(_src=URL(r=request,c='static',f='icons/ star.png'),_class='icons',_title='Remove from favourites',_alt='Remove from favourites'),_id="fav").xml() Basically a div containing an image, which I thought would be serialized as that single portion, not as an entire view, resulting in the page within page problem. Cleary still have much to learn. Could you help me out further? Thanks On Mar 2, 9:14 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > You are returning a view that contains {{extend "layout.html"}} when > you return the ajax, so since your returning the entire page html... > you insert the page over again :) > > You can > > A) Return a view that does not extend layout > B) Return a string that represents the html instead of a dict > C) Call it with .json instead of .html so that your dict gets > serialized into JSON and returned. > > -Thadeus > > > > On Tue, Mar 2, 2010 at 3:03 PM, LB22 <latn.bl...@googlemail.com> wrote: > > OK, so I tried upgrading, but still the same result I'm afraid. I > > figured I must be doing something wrong. Is there another method I > > could try to acheive the same result? Or do you know what I might be > > doing wrong? > > > I'm just trying to mark something (by inserting a record into my db), > > and replace the existing image to reflect the current state (marked/ > > unmarked). > > > Thanks > > > On 2 Mar, 20:37, LB22 <latn.bl...@googlemail.com> wrote: > >> Hmm...no I'm actually using 1.75.4. I'll try upgrading and report back > >> what happens. > > >> On 2 Mar, 19:24, mdipierro <mdipie...@cs.depaul.edu> wrote: > > >> > Are you using the latest web2py? > > >> > On Mar 2, 11:57 am, LB22 <latn.bl...@googlemail.com> wrote: > > >> > > Hi there, > > >> > > I'm having a small problem and am not sure where I'm going wrong. I'm > >> > > familar with javascript and have used query for some basic stuff, but > >> > > this is the first time I've tried to incorporate any ajax. > > >> > > I have in my controller something like: > > >> > > def mark(): > >> > > check.marker(request.args[0],request.args[1]) # decides how to > >> > > update db.table > >> > > return check.chooser(request.args[0],request.args[1]) # decides > >> > > which icon to display and returns it > > >> > > In the view I have this: > > >> > > <div id='test'>{{=XML(button)}}</div> > >> > > <span > >> > > onclick="ajax('{{=URL(r=request,f='mark',args=[arg0,arg1])}}', [], > >> > > 'test');">ClickMe</span> > > >> > > Instead of replacing the existing image (XML(button)) with the > >> > > returned one, it inserts the entire page again overlapped on the > >> > > existing page. Does anyone know where I'm going wrong? > > >> > > Thanks in advance for any help. > > >> > > LB22 > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.