簡體   English   中英

在AJAX回調中打印服務器響應(使用jquery)

[英]Printing server response in an AJAX callback (using jquery)

我可以控制我的服務器端點

@app.route('/predict', methods=['GET', 'POST', 'OPTIONS'])
@crossdomain(origin='*')

def predict():
  return 'predict12'

我想在我的AJAX調用的回調中返回predict12

$.ajax({
  type: "POST",
  url: 'https://linear-yen-140912.appspot.com/predict',
  data: 'data',
  success: function test(){console.log()},
});

我應該在success函數中predict12什么內容,以便它輸出predict12

$.ajax({
type: "POST",
url: 'https://linear-yen-140912.appspot.com/predict',
data: 'data',
success: function test(result){console.log(result)},
});

成功是AJAX調用的結果,那就是您應該使用的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM