/ / ajax応答を取得した後にブートストラップモーダルを完全に非表示にする方法-ajax、twitter-bootstrap、cakephp、response

ajaxレスポンスを取得した後のブートストラップモーダルを完全に隠す方法 - ajax、twitter-bootstrap、cakephp、レスポンス

// From Ctp
hcp_btn.on("click", function(){
var value = hcp_field.val();
if(value != "")
{
$.ajax(
{
type: "POST",
url: ajax_url+"users/add_hcp_type/"+value,
success:function(response)
{
if(response == "exist")
{
$("#hcp_error").show();
hcp_btn.addClass("disabled");
}
else{
$("#hcp_type_modal").modal("hide");
$("#hcp_type").html(response);
}
}
});
}
});

// For Controller
$this->autoRender = false;
$this->layout = "ajax";
$this->viewPath = "Elements";
$this->render("hcp_types");


![This type of background left after modal close in ajax success function][1]

私はcakephpを使用しており、要素を使用してレンダリングしていますajaxおよびctp内のデータを動的にロードします。しかし、ajax成功関数内でajax応答を取得した後、ブートストラップモーダルナットモーダルを閉じようとしていますが、透明な背景が完全に閉じていません。

回答:

回答№1は0

これを使用して、左の背景をきれいにします

//when hidden
$("#hcp_type_modal").on("hidden.bs.modal", function(e) {
$(".modal-backdrop").remove();
});