在服务器端,我只是将json作为字典打印到控制台
@app.route('/',methods=['GET','POST'])
@login_required
def index():
if request.method == "POST":
print request.json.keys()
return "hello world"
现在,每当我通过ajax发出post请求时,控制台就会打印出包含我需要的内容的字典.
On the client-side, I have been trying to use various methods to execute some jquery based on a successfull ajax call. I just realized that this might be an error on my server-side, i.e I am not sending any request header to tell jquery that its ajax call was a success.
So how do I send an OK status back to my client to tell it everything is all right?
为了完整起见,以下是我的客户端代码
$.ajax({
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(myData),
dataType: 'json',
url: '/',
success: function () {
console.log("This is never getting printed!!")
}});