我试图在一个隐藏在另一个模态旁边的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 '
echo 'alert("Verification Complete");';
echo '';
while ($results = $query->fetch()) {
$Studname = $results['Studentname'];
echo '
echo 'alert("'.$Msg.$Studname.'")';
echo '';
echo '
echo '$(File).ready(function() {';
echo '$("#myAdvert").modal("show");';
echo '});';
echo '';
}
} else {
echo '
echo 'alert("Sorry your ID was not found");';
echo 'window.location.href = "/Koleesy/index.html";';
echo '';
}
?>
在欢迎用户之后,我希望调用index.html中的隐藏模态,以便用户可以继续提交广告.
我尝试过使用include功能,但这似乎对我不利.
我该怎么做呢?
每个答案都表示赞赏.
解决方法:
试试这个:
echo "
$(document).ready(function(){
$('#myAdvert').modal('show');
});
";
标签:jquery,php,javascript,twitter-bootstrap,html
来源: https://codeday.me/bug/20190623/1271759.html