简体   繁体   English

在 PHP 中使用 Javascript 打开引导模式

[英]Open bootstrap modal using Javascript in PHP

I'm trying to open bootstrap modal after login failed, I used the following code:我试图在登录失败后打开引导模式,我使用了以下代码:

if (mysqli_num_rows($query) != 0)
{
    // Login successfully
}
else
{ 
    //Login failed
    echo '<script type="text/javascript"> $("#LoginFailed").modal("show")</script>';
} 

And I incloud jQuery 1.12.4 in HTML head我在 HTML 头中嵌入了 jQuery 1.12.4

<script src="js/jquery-1.12.4.js"></script>

Nothing happen, The LoginFailed modal not showing up !!什么也没有发生, LoginFailed失败模式没有出现!!

I also trying the solution HERE but no luck.我也在这里尝试解决方案,但没有运气。

Any help?有什么帮助吗?

See exemple参见示例

I tried to tailor the exemple to yours.我试图根据你的例子来定制这个例子。 NOTE: In JSFiddle it will not be accurate since it only runs js css and HTML注意:在 JSFiddle 中它不会准确,因为它只运行 js css 和 HTML

You need to use你需要使用

jQuery(document).ready(function (e) {
    // Your Modal
}

你应该在jquery-1.12.4.js之后包含bootstrap.min.js文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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