I'm basically just having problems that Thadeus seemed to have
described above.
I'm trying to use the ajax() function but it seems like an entire page
is being fed into the target rather than a string I'm returning.
This is in my view,
<b>Votes received: </b><span id="sreq{{=sreq.id}}">{{=votes_received}}
</span><br/>
[<span onclick="ajax('vote_yay', ['sreq_id'],
'sreq{{=sreq.id}}');">Vote Yay</a>]
The function vote_yay returns a string. However, doesn't seem like the
function is being executed and an entire page is fed into the target.
Is it still OK to use the ajax function? Sorry for hijacking the
thread btw :/
On Mar 2, 3:25 pm, mdipierro <[email protected]> wrote:
> I do not even remember what is in the manual. Plugins are the
> future... even if they may change.
>
> On Mar 2, 5:19 pm, minh <[email protected]> wrote:
>
> > Should I disregard the example in the manual or is there a simple
> > tweak I can do to get it working.
>
> > The plugin you mentioned seems a little more involved... don't want to
> > get into it if there's an easy fix for the former method.
>
> > On Mar 2, 2:42 pm, mdipierro <[email protected]> wrote:
>
> > > The manual is old in this respect. I assume you have seen
> > > this:http://web2py.com/plugins/default/rating
>
> > > On Mar 2, 4:36 pm, minh <[email protected]> wrote:
>
> > > > I'm trying to implement the voting/rating example from the manual and
> > > > I'm getting a similar issue with the page overlapping.
>
> > > > On Mar 2, 2:26 pm, LB22 <[email protected]> wrote:
>
> > > > > 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 <[email protected]> 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 <[email protected]>
> > > > > > 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 <[email protected]> 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 <[email protected]> wrote:
>
> > > > > > >> > Are you using the latest web2py?
>
> > > > > > >> > On Mar 2, 11:57 am, LB22 <[email protected]> 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 [email protected].
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected].
> > > > > > > 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.