我的ajax代码:
$.ajax({
type: 'POST',
url: URL + "xyz/" ,
data: {"email": email},
success: function(data) {
alert('hello')
},
dataType: "json",
});
我在 python + Bottle 框架中的处理程序:
def index():
if request.POST == XMLHttpRequest:
email = request.GET.get('email')
response.COOKIES['email'] = email
if check_email(email): //a method written for checking email
return some template
else:
return False //here i want to return some error message to ajax. How to
做吗?以及如何在 ajax 中捕获错误。
抛出错误:NameError("global name 'XMLHttpRequest' is not defined",) 是瓶子支持吗?