Technically
{{=LOAD('application','default', 'comment.load', args=result.id,
ajax=True)}}
so the first argument 'application' is option. Anyway, your problem is that
you had the 'comment.load' argument but after args=result.id. That is a
Python issue, not a web2py issue. You cannot have un-named arguments after
named ones.
On Saturday, 8 December 2012 17:00:45 UTC-6, jonas wrote:
>
> ok, I've got confused, the manual stated that the first argument was
> optional.
>
> On Saturday, December 8, 2012 11:47:21 PM UTC+1, Massimo Di Pierro wrote:
>>
>> {{=LOAD('comment',args=result.id,'comment.load',ajax=True)}}
>>
>> should be
>>
>> {{=LOAD('default', 'comment.load', args=result.id, ajax=True)}}
>>
>> On Saturday, 8 December 2012 16:26:02 UTC-6, jonas wrote:
>>>
>>> LOAD looks interesting. trying to LOAD comment form but gets error
>>> (non-keyword
>>> arg after keyword arg) when using the following button:
>>>
>>> <a class="btn"
>>> href={{=LOAD('comment',args=result.id,'comment.load',ajax=True)}}
>>> rel="tooltip" title="give a comment"><i class="icon-pencil"></i></a>
>>>
>>> On Saturday, December 8, 2012 6:29:14 PM UTC+1, Niphlod wrote:
>>>>
>>>> maybe you'll be better off with a component (LOAD()) for that
>>>>
>>>> On Saturday, December 8, 2012 5:00:41 PM UTC+1, jonas wrote:
>>>>>
>>>>> Thanks, that solved the callback problem. now I just have to figure
>>>>> how to update part of the index.html view.
>>>>>
>>>>> On Sat, Dec 8, 2012 at 4:25 PM, Niphlod <[email protected]> wrote:
>>>>> > use the power, Luke!
>>>>> > you have something like this
>>>>> > A(TAG.i(_class="icon-thumbs-up"), _rel="tooltip", _title="you like
>>>>> this",
>>>>> > _class="btn", _href=URL("plus",args=result.id))
>>>>> > and you can turn it into a callback using
>>>>> > A(TAG.i(_class="icon-thumbs-up"), _rel="tooltip", _title="you like
>>>>> this",
>>>>> > _class="btn", callback=URL("plus",args=result.id))
>>>>> >
>>>>> >
>>>>> > On Saturday, December 8, 2012 3:42:49 PM UTC+1, jonas wrote:
>>>>> >>
>>>>> >> Hi
>>>>> >>
>>>>> >> I still have some problems with callbacks. I have a like button
>>>>> that is in
>>>>> >> my index.html view that add 1 to a database, then displays it:
>>>>> >>
>>>>> >> <a class="btn" href={{=URL("plus",args=result.id)}} rel="tooltip"
>>>>> >> title="you like this"><i class="icon-thumbs-up"></i></a>
>>>>> >>
>>>>> >> I want to call the plus function as a callback to avoid render
>>>>> another
>>>>> >> view, i.e I want to render the result in the index view, but I
>>>>> don't know
>>>>> >> how to replace it in the above format. I also have to send the id
>>>>> to the
>>>>> >> callback.
>>>>> >>
>>>>> >> the function:
>>>>> >>
>>>>> >> def plus():
>>>>> >>
>>>>> >> """ add or subtract likes """
>>>>> >> print "called",request.args(0)
>>>>> >> db(db.blog.id==request.args(0)).update(plus=db.blog.plus+1.0)
>>>>> >> db.commit()
>>>>> >>
>>>>> >> # redirect(URL('index'))
>>>>> >>
>>>>> > --
>>>>> >
>>>>> >
>>>>> >
>>>>>
>>>>
--