でAJAX呼び出しからPOSTの結果を返す:はJSに追従している私は何をしようとしているJavaScriptの
function getSuccessForTest(testName,version,fromRev,toRev,res) {
var params = {
"methodToRun":"getSuccessForTest",
"version":version,
"startRev":fromRev,
"endRev":toRev,
"testName":testName
};
$.post("Stats.php", params,function(data){
return parseInt(data.toString(),10);
}, "json");
}
getSuccessForTest(data[i],version,fromRev,toRev,res);
私が間違って何をしているのですか?私がgetSuccessForTestを呼び出すたびに、私はStats.phpでPOST結果を取得しますが、値は呼び出し元の関数に返されません。
ありがとうございます!
これらのすべてが重複しています:http://stackoverflow.com/search?q=jquery+return+value+from+ajax+call –
[関数の外でJSONP呼び出しの結果を返す方法?](http://stackoverflow.com/questions/1341810/how-to-return-the-result-from-jsonp-call-outside-the-function) –