AJAX modals with Bootstrap 3

Bootstrap 3 provides support for loading content into a modal via ajax. Like so —

<button href="remotePage.php" data-toggle="modal" data-target="#myModal">Fetch</button>

However, one annoyance is that once it loads a page you can no longer request a different page – the request to /remotePage.php won’t be sent again. This is a problem if you have various buttons that request different information.

You can “reset” it after a modal is closed by adding this code to your page (in script tags) —

$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});

Ultimate do “not cache this page” for PHP

Below is the ultimate set of headers to send from PHP to ensure a page is not cached —

header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

The best instant coffee

I’m now quite convinced that the best quality instant coffee (at least in South Africa) is Douwe Egberts Pure Gold. Below is the scale of instant coffee here – 

  1. 10/10 – Douwe Eggberts
  2. 7/10 – Jacobs
  3. 5/10 – Nescafe

The other brands I really can’t be bothered to even rate. Anyway, if you like Jacobs or Nescafe you should definitely give Douwe Egberts a try.