简体   繁体   中英

Automatic appear the popup window based on condition like When i get the url http://localhost:81/Try/demo?result=false

Automatic appear the popup window basen on condition like When i get the url http://localhost:81/Try/demo?result=false . Below the sample code.I am using colorBox popup. It will show the popup window when i'm click the link Inline HTML. I need automated popup if ($_REQUEST['result']==false) in PHP

<script src="../jquery.colorbox.js"></script>
<script>
    $(document).ready(function(){               
        $(".inline").colorbox({inline:true, width:"50%"});              
    });
</script>
</head>
<body>
    <h1>WELCOME</h1>
        <p><a class='inline' href="#inline_content">Inline HTML</a></p>

        <!-- This contains the hidden content for inline calls -->
        <div style='display:none'>
            <div id='inline_content' style='padding:10px; background:#fff;'>
            <p><strong>This content comes from a hidden element on this  page.</strong>
           </p>
            <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.</p>          
            <a href="download.csv">Click here to download file</a></p>
            </div>
        </div>
</body>

I don't know what you mean by 'popup', but here is how to do something in javascript if 'result' is false.

<script>
    <?php if($_REQUEST["result"]=="false") {
        echo "alert('result is false')";
    }?>
</script>

It is also possible to do this in JavaScript like so:

if (document.location.query.indexOf('result=false') !== -1) {
  alert('result is false');
}

You would need some sort of modal implementation if you want to show a whole modal (ie Bootstrap Modal, jQuery UI Modal, custom, etc).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM