我不明白成功函數如何在使用jquery的$ .ajax調用中工作。
例如
$.ajax({
type: "POST",
url: "ajax.php",
data: "function=1",
success: function(data,response,jqxhr){
useReturnData(data /* ??? not sure how to use the data var */);
}
};
ajax.php:
<?php
if ($_REQUEST['function'] == '1'){
$string = "this is the data i want to return and use";
}
?>
如何使用該功能的成功中的數據?沒有哪裏可以解釋數據參數是什麼,他們只是模糊地使用它。
另一方面的問題,是數據:「function = 1」與數據有關,作爲成功函數的參數嗎?
這是更好的... – jeroen