in notification list I used sql query to display domain name but i want to each domain name when I click on that will open popup with there details.
this is header file---
<!-- notification start -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
<ul class="dropdown-menu short-dropdown-menu">
<li class=""> <a href="<?=Url::to(['domains/index']);?>">
<?php
$domains=Domains::find()
->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
->andWhere(['or',
['status'=> 'Active'],
['status'=> 'Pending Transfer']
])
->orderBy(['expirydate' => SORT_ASC])
->all();
$domainList=ArrayHelper::map($domains,'id','domainname');
foreach($domainList as $key => $value)
{
print '<br>'. $value .'<br>';
}
?>
</a></li>
</ul>
</li>
<!-- notification ends -->
now result is open like ---
when click on that domain name it have to display popup with details like below image-----
UPDATE QUESTION:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
<ul class="dropdown-menu short-dropdown-menu">
<li class="">
<a href="#modal-domaindetails" data-toggle="modal" onclick="getDomainDetails('2696')">
<?php
$domains=Domains::find()
->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
->andWhere([
'or',
['status'=> 'Active'],
['status'=> 'Pending Transfer']
])
->orderBy(['expirydate' => SORT_ASC])
->all();
$domainList=ArrayHelper::map($domains,'did','domainname');
foreach($domainList as $key => $value) {
print '<br>'. $value .'<br>';
}
?>
</a>
</li>
</ul>
</a>
</li>
see this now i am passing id 2696 but i want to take id as per domain name how is it possible
In my opinion, I have some view of it.
If you want to open a new popup modal, you have to create a modal popup, like that https://getbootstrap.com/docs/4.1/components/modal/
You put URL redirect to domain name as ">, it will be redirected to this link. You can not get any pop up here, except you want to open a new tab or new window in chrome. (with open new tab or new window you can search it on google)
In "li" and "a" tag
<li class=""> <a href="your_url"> ... your code php foreach($domainList as $key => $value) { print '<br>'. $value .'<br>'; } </a> </li>
you put an iterator, it will be rending a list but they have the same redirect to a URL
UPDATE MY ANSWER
Maybe I hope it will help you.
HTML:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
<ul class="dropdown-menu short-dropdown-menu">
<li class="">
<?php
$domains=Domains::find()
->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
->andWhere([
'or',
['status'=> 'Active'],
['status'=> 'Pending Transfer']
])
->orderBy(['expirydate' => SORT_ASC])
->all();
$domainList=ArrayHelper::map($domains,'did','domainname');
foreach($domainList as $key => $value) {
?>
<a href="javascript:;" onclick="getDomainDetails('<?= $key ?>')"><?= $value ?></a>
<?php
}
?>
</li>
</ul>
</a>
</li>
Added Modal popup
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
JAVASCRIPT
<script>
function getDomainDetails(domain_id) {
$.ajax({
url: 'domains/index',
method: 'GET', // or 'POST'
data: { domain_id : domain_id }
})
.done(function(response) {
$('#exampleModal').find('.modal-body').html(response); // append reponse html from server
$('#exampleModal').modal('show'); // show modal
});
}
</script>
Using bootstrap modal
When click link, open modal
Request to server get data
Using jquery for render data again