我有回拨电话@申请前申请在我的烧瓶申请。在
@app.before_request
def before_request():
def alert(response):
response.alert('Message')
if g.sijax.is_sijax_request:
g.sijax.register_callback('alert', alert)
return g.sijax.process_request()
我之所以这样做是因为Ajax请求出现在应用程序的每个页面上。直到我想要一个特定于页面的回调,即在视图中使用Sijax定义AJAX请求,因为if g.sijax.is_sijax_request:
被使用了两次,所以我无法注册特定于视图的回调。在
有没有解决这个问题的方法?谢谢。在
在after\u request事件中注册默认回调,并检查
_callback
字典是否为空,如果为空,则注册默认回调,否则将传递现有响应。在相关问题 更多 >
编程相关推荐