// 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]
Sto usando cakephp e renderizzo un elemento usandoajax e caricamento dinamico dei dati all'interno del ctp. Ma dopo aver ottenuto la risposta Ajax all'interno della funzione di successo Ajax sto cercando di chiudere il dado modale bootstrap modale non è completamente chiuso è rimasto un po 'di sfondo trasparente.
risposte:
0 per risposta № 1Usa questo per pulire lo sfondo a sinistra
//when hidden
$("#hcp_type_modal").on("hidden.bs.modal", function(e) {
$(".modal-backdrop").remove();
});