FishHook
то есть так сделай
Ага, так работает, тег <form> удалил, POST запросы отправляются. Только сервер в ответ 500 ошибку выдает. И соответственно я не получаю data.
Сервер у меня запускается на localhost:8080
urls = ('/','root')
app = web.application(urls, globals())
render = web.template.render('templates/')
class root:
def GET(self):
return render.mytitle("Robot")
def POST(self):
i = web.input()
if i.form_action == 'decrease speed forward':
print 'decrease speed forward'
elif i.form_action == 'forward':
print 'forward'
elif i.form_action == 'increase speed forward':
print 'increase speed forward'
else:
print '+++++++++++++++++'
код кнопки из html файла
<button onclick="$$.post('/', {data: 'decrease speed forward'})">
Ошибка
Request URL:http://localhost:8080/
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview parsed
POST / HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 27
Accept: */*
Origin: http://localhost:8080
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost:8080/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ru;q=0.6
Form Dataview parsed
data=decrease+speed+forward
Response Headersview parsed
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
Transfer-Encoding: chunked
Date: Wed, 14 Aug 2013 13:26:45 GMT
Server: localhost