[英]Printing server response in an AJAX callback (using jquery)
I have control over my server endpoint 我可以控制我的服务器端点
@app.route('/predict', methods=['GET', 'POST', 'OPTIONS'])
@crossdomain(origin='*')
def predict():
return 'predict12'
I want to return predict12
in the callback of my AJAX call. 我想在我的AJAX调用的回调中返回
predict12
。
$.ajax({
type: "POST",
url: 'https://linear-yen-140912.appspot.com/predict',
data: 'data',
success: function test(){console.log()},
});
What should I put in the success
function so it prints predict12
? 我应该在
success
函数中predict12
什么内容,以便它输出predict12
?
$.ajax({
type: "POST",
url: 'https://linear-yen-140912.appspot.com/predict',
data: 'data',
success: function test(result){console.log(result)},
});
the success has the result of the AJAX call, and thats what you should be using 成功是AJAX调用的结果,那就是您应该使用的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.