0

Currently I'm using bootstrap modal popup(call those modals dynamically).

All are working fine but it does not show the updated content until I reload the page. This because hide and show events. I'm using the events like wise.

this for show the modal

 $('ModalID').modal({ remote: "RemoteURL"});

this for hide the particular modal

 $('ModalID').modal("hide"); 

If I have single modal it's OK but if I'm managing more then one modal at a page, it will not give the updated modal.

So is there is any possibility to reload the modal pop-up for each request instead of showing the modal which was already loaded, or any other way to show updated modal each and every time?

BENARD Patrick
  • 30,363
  • 16
  • 99
  • 105
Arun
  • 27
  • 1
  • 4
  • The `remote` option of modals is deprecated. I would advise against using it; just implement the loading yourself. – cvrebert Sep 02 '14 at 23:04
  • possible duplicate of [Twitter bootstrap remote modal shows same content everytime](http://stackoverflow.com/questions/12286332/twitter-bootstrap-remote-modal-shows-same-content-everytime) – cvrebert Sep 02 '14 at 23:05

1 Answers1

0

I had similiar problem with Bootstrap and solved it by manually using JS api like this:

var ajaxModal = function(url,div,update_div){
  if(div===undefined){
    div="#myModal";
  }
  if(update_div===undefined){
    update_div="#myModalContent";
  }
  $.get(url, function(data){
    $(update_div).html(data);
    $(div).modal({});
  }).fail(function(){
    alert("błąd");
  });
};
kosto
  • 84
  • 7
  • this one works for me `$('body').on('hidden.bs.modal', '.modal', function () { $(this).removeData('bs.modal'); });` – Arun Sep 03 '14 at 14:07