2016-09-12 9 views
0

私は私のサーバーのエンドポイント印刷サーバの応答

@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()}, 
}); 

それはpredict12を出力するので、私はsuccess機能に何を置くべき?

+0

はこのような何かにあなたの成功の機能を変更してみてください使用すべきかのthats: '成功:機能テスト(コールバック){はconsole.log(コールバック)} ' – TheMintyMate

+0

ありがとう!それはうまくいった。 –

+0

jQueryでAjaxのドキュメントを読んでいませんか? – epascarello

答えて

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

成功は、AJAX呼び出しの結果を持っている、とあなたは

+0

コールバックも機能しました。 JSの結果/コールバック特有の用語ですか? –

+0

「コールバック」とは何ですか?結果は特別な用語ではなく、あなたが望むものを呼び出すことができます。 – snit80

関連する問題