私はajaxリクエストをすると、私のために何かをするPHPスクリプトに行きます。 データベースからレコードを削除するか、削除しません。jquery ajax-php question
私はhtmlテーブルを削除して更新したい。それ以外のエラーメッセージを表示したい。
しかし、私のPHPで私は私の結果や私のメッセージをエコーした後、私のjQueryのスクリプトはそれで何かを行います必要
return false;
return true;
ような何かを行うことはできません。
しかし、結果に応じてjqueryに何かをさせることができますか?ここで例えば
:
jQuery.ajax({
type: "POST",
data: "id=" +id,
url: "ajax_handler.php",
success: function(msg){
jQuery(tr).remove();
jQuery("div.result").append("<p>"+msg+"</p>");
jQuery("div.result").show();
jQuery("div.result").fadeOut(5000);
},
error: function(msg){
}
とPHPコード
$id = C_GPC::getPOSTvar("id");
$result ="";
if(isset($id) and ($id > 0)){
$p = new C_product();
$deleted = $p->deleteCategorie($id);
if($deleted){
$result = "ok";
}else{
$result = "not ok";
}
}else{
$result = "not ok";
}
echo $result;
は私がやりたい時に[OK]と[Bたら、[OK]ではありません。私はこれをどのように扱うべきですか? });