Bootstrap mode box remote loading Web page is handled correctly

Source: Internet
Author: User
Tags button type

Bootstrap modal frame Remote loading Web page method

This method is given in the Bootsrap modal box document:

Using link mode

<a data-toggle= "modal" href= "tieniu.php" data-target= "#modal" >click me</a>

Using script mode:

$ ("#modal"). Modal ({    "tieniu.php"});

No instances are given, and there are some details that are not explained in this usage. If you just copy and use it, that's no effect.

Many friends in the online problem this problem, most people in the copy and paste, they did not verify, on the chaos reply, alas!

The following is the code for the correct modal box remote Load method

Client code

<a data-toggle= "modal" href= "tieniu.php" data-target= "#modal" >click me</a><div class= "modal" id= " Modal ">        <div class=" Modal-dialog ">            <div class=" Modal-content ">                  <!-- Here is a remote loaded content area-           </div>        </div> </div>    

Server-side code , the service-side code needs to contain a portion of the modal box text, please note

 <?php  $rnd  =rand  (1000,9999);? ><div class  = "Modal-header" > <button type= "button" class  = "Close" data-dismiss= "modal" aria-hidden= "true" >&times;</button> 

class = "Modal-title" >modal titleclass = "Modal-body" > <?php echo $rnd ;? ></div><div class = "Modal-footer" > <button type= "button" Span style= "color: #0000ff;" >class = "btn Btn-default" data-dismiss= "modal" >Close</button> <button type= "button" class = "btn btn-primary" >save changes</button></div>

Close modal box, call remote page again, but content does not refresh

Here's how to fix it

$ (document). Ready (function  () {     $(function() {     $(this). Removedata ("Bs.modal");} )

Bootstrap mode box remote loading Web page is handled correctly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.