Simple Bootstrap Modal with Dynamic content Using remote URL

Model is very important UI for any website, normally every website use modal box to show message, add and edit data etc. Here, We will learn how to create popup box based on http URL.The url can be separate file or mvc based url. We will use window manager class to create model box.The open method takes class name,window id and content url as parameters.

Since remote_url option has been deprecated on bootstrap v3.3.0 and will be removed in v4, so we have used or calling jQuery.load method to load content in modal window.

The main benefit of jQuery's load method is the modal content will be dynamic instead of static or loaded one time like remote URL.

Yo can also Checkout other Modal Box tutorial,

We have used following file to create modal popup using bootstrap

  1. index.php : This file will be used to define all library files and load content.
  2. modalbox.php : This file will participate to create modal layout.

Steps to Create Bootstrap Modal Using jQuery load() method

Step 1: We have included all bootstrap and jquery files into index.php file.

Let’s create a button open modal box –

In above code, Created a link which is used to show bootstrap modal window.

Step 2: We have created modal window file modalbox.php and added below code into this file.

Step 3: Let’s call jquery load() method using target modal URL file path and show modal popup.

Simple Demo and Example of Bootstrap Modal With Url