I have a div class for an image search button:
<div class="form-group">
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
<?php
$link = "https://source.unsplash.com/all/?";
$c=$link.$article->title;
?>
document.getElementById("demo").innerHTML ="
<?php echo "
<img src=".$c." height='100' width='100'/>"?>"
}
</script>
</div>
If I click on this button I get an image from this url by my keyword:
https://source.unsplash.com/all/?
But if I want to choose another image by clicking on this button, I have to refresh my page. So the question is: Can I choose another image without page-refresh just by clicking the same search button? Sorry for my english.
$article->title
value. And, since you didn't show this part of the code, i'm assuming that's the page you are. Just refreshing it, will not work. – Clyff