Thanks DenesL.

if I use ajax('submit_comment',....):
  on version 1.91.6, when I click the button on people.html, the data
is posted to people()
  on version 1.92.1, an 404 error occurred if I click the button to post data:
      invalid controller (submit_comment/index)

if I use ajax("{{=URL(f='submit_comment')}}",.....):
  on version 1.91.6, everythings works fine.
  on version 1.92.1, an 500 error occurred if I click the button to post data:
    in "controllers/default.py", line 140
    SyntaxError: Table: missing required field: comment_time,
    but I have defined a default value for comment_time:
       Field('comment_time', 'datetime', required=True,
default=datetime.datetime.today())
    I think this issue can be fixed by passing a datetime value in the
insert() statement.

OS:  Windows.
browser: firefox.

I can send the application to you if you want to follow this issue.
Thanks a lot.


On Sat, Feb 26, 2011 at 12:51 AM, DenesL <denes1...@yahoo.ca> wrote:
>
> Please tell us which web2py version, which browser, which OS, etc.
>
>
> On Feb 25, 2:17 am, zhao peng <zhaopen...@gmail.com> wrote:
>> Hi,
>>
>>   I followed the js code in firebug, the url passed to ajax() is
>> 'submit_comment', and I dont konw why the data posted to people().
>>
>>   I fixed this issue by modify the url to ajax():
>>
>>   ajax("{{=URL(f='submit_comment')}}",['hidden_id', 'hidden_author',
>> 'hidden_text'],'comment_list_'+id);
>>
>>   the url passed to ajax() is "/appname/default/submit_comment".
>>
>> On Thu, Feb 24, 2011 at 9:57 PM, DenesL <denes1...@yahoo.ca> wrote:
>>
>> > Hi,
>>
>> > I don't see anything wrong.
>> > Can you post more of your code?.
>>
>> > On Feb 24, 6:19 am, zhao peng <zhaopen...@gmail.com> wrote:
>> >> hi,
>>
>> >> I defined two functions in controllers/default.py:
>> >>   def submit_comment():
>> >>   .....
>>
>> >>  def people():
>> >>   ...
>>
>> >> and in the default/people.html, I want to use ajax to post data to
>> >> submit_comment():
>> >>    ajax('submit_comment',['id', 'author', 'text'],'comment_list_'+id);
>>
>> >> but by my testing, the ajax() posts data to people().  Can someone
>> >> help me? thanks.
>>
>>

Reply via email to