0
我正在研究一個將數據提交給REST API並且有一些問題的應用程序。來自REST API的jQuery Post回調
jQuery如何知道我的發佈請求是否成功?它只查看HTTP狀態嗎?
是否有關於從POST請求返回到REST API的約定?
的JavaScript
$.post(\t '/API/removeUser', { Eid: id }, function(data) { row.remove(); });
PHP框架SLIM
$app->POST('/API/removeUser', function() use ($app) {
// Get the ID from the jQuery post \t \t \t \t
$Eid = trim(stripslashes(htmlspecialchars($_POST['Eid']))); \t \t \t
\t echo json_encode(removeFunction($Eid));
\t
});