gpt4 book ai didi

javascript - 如何在php中调用bootstrap modal

转载 作者:可可西里 更新时间:2023-10-31 23:03:13 26 4
gpt4 key购买 nike

我正在尝试调用隐藏在另一个模态旁边的 html 文件中的模态。其中一个在单击按钮时出现,但另一个将由 php 作为验证过程的一部分调用。

这是我的 PHP 代码:

$File = include("index2.html");
$Msg = 'Welcome ';
$search=$_POST['search'];
$query = $pdo->prepare("SELECT * FROM students WHERE IDs LIKE '%$search%' LIMIT 0 , 10"); //OR author LIKE '%$search%'
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();
// Display search result
if (!$query->rowCount() == 0) {
echo '<script type="text/javascript">';
echo 'alert("Verification Complete");';
echo '</script>';



while ($results = $query->fetch()) {

$Studname = $results['Studentname'];


echo '<script type="text/javascript">';
echo 'alert("'.$Msg.$Studname.'")';
echo '</script>';



echo '<script type="text/javascript">';
echo '$(File).ready(function() {';
echo '$("#myAdvert").modal("show");';
echo '});';
echo '</script>';

}

} else {
echo '<script language="javascript">';
echo 'alert("Sorry your ID was not found");';
echo 'window.location.href = "/Koleesy/index.html";';
echo '</script>';
}
?>

欢迎用户后,我希望调用 index.html 中的隐藏模式,以便用户可以继续提交广告。我试过使用 include 函数,但这似乎对我不利。我该怎么做呢?每一个答案表示赞赏。

最佳答案

试试这个:

echo "<script type='text/javascript'>
$(document).ready(function(){
$('#myAdvert').modal('show');
});
</script>";

关于javascript - 如何在php中调用bootstrap modal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33389538/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com