I am quite new as web developer, I find myself trying to resolve a problem.
I would like to pass a value JavaScript to PHP without using any form method.
Here my PHP code (it is a slideshow in which I put an onclick event in img tag in order to get the id of image that is clicked, then the id information is stored in a variable on my JavaScript file. The question is: how can I pass that variable to PHP from my JavaScript file?):
Thanks in advance. Best regards,
function getIdImage(clicked_id)
{
// alert(clicked_id);
var ClickedId= clicked_id;
}
<div class="row">
<div class="col-xs-12 col-md-12 col-lg-12 widhest">
<div class="bx_wrapper_photo_below">
<ul id="bx_slider_photo_below" class="bx_viewport_photo_below">
<?php while($line = mysqli_fetch_assoc($outcomesListPhotos1)) {?>
<li>
<img src="photos/<?php echo utf8_encode($line['photo']); ?>" class="img-responsive" onclick="getIdImage(<?php echo utf8_encode($line['id_photo']);?>)">
</li>
<?php }?>
</ul>
<a class="pager-prev_below"><i class="icon-chevron-left"></i></a>
<a class="pager-next_below"><i class="icon-chevron-right"></i></a>
</div>
</div>
</div>
Fabio
ajax.