postJson和getJson
Topic source问题:一直卡在form的数据post不过来,所以一直创建不了blog,网页提示是form没有postJson方法,也去找了一下jQuery和js,没有发现这个方法,估计getJson方法也没有,老师自己写的方法?awesome.js中也搜不到。
解决:对html进行改写。在js中,使用$('#edit-blog').submit()方法,并且改写下form:< form id='edit-blog' action='{{ action }}' method='post' ....。还有就是handlers.py的api_create_blog() return
不足:vue的特性体现不出来了?另,如果出现错误,没提示(懒得写了。。。)
利用 response_factory的判断条件
if isinstance(r, str):
if r.startswith('redirect:'):
return web.HTTPFound(r[9:])
改写handlers.py的api_create_blog return ‘redirect:/manage/blogs’
- 1
装僵尸的大海
有没有大神解释一下postJson()。它是jquery吗,试试其他的语法函数。
我卡在postJson上了,网页提示object don't support method 'postJson'。
是因为没加上什么吗?反正也post提交数据不了