the url you are using is incomplete... try using URL()
$.post('{{=URL("init.html")}}', function(data){ ....} )
mic
2011/6/27 Bruce Dickey <[email protected]>:
> I've just started using web2py and had an ajax call working, but must
> have done something that broke it. I've been backing out changes but
> have not been able to find what went wrong. The call in my js file is
>
> $.post('init.html', function(data) { ...
>
> and then in /controllers/default.py there is a
>
> def init():
> return "test"
>
> The ajax call fails with 400, and the server log says:
>
> 127.0.0.1, 2011-06-27 09:49:43, POST, /init.html, HTTP/1.1, 400,
> 0.000378
>
> Firebug says:
>
> Response Headers
> Content-Length 573
> Content-Type text/html; charset=UTF-8
> web2py_error invalid path
> Date Mon, 27 Jun 2011 15:49:43 GMT
> Server Rocket 1.2.2 Python/2.6.6
> Connection keep-alive
>
> So it looks to me like somehow the init() function in /controllers/
> default.py is no longer found. Please, can someone tell me what I
> might have clobbered to break this? Or what steps I could take to
> debug? (I have run web2py in the WingIDE debugger, but it was hard to
> follow the path checking thru the regex stuff).
>
> Thanks,
> Bruce
>
>
>