I need to pass image id to mysql query.
For that, i have done these coding. But it results in Undefined index x: I referenced many stackoverflow answers. But nothing is working.
echo "<img src=http://localhost/ss/img/".$p['path']." id=".$p['album_id']." class='img-responsive' alt='' data-toggle='modal' data-target='.bs-example-modal-lg1'>";
if(isset($_GET['x'])) { echo $_GET['x']'; }
<script>
$(document).ready(function() {
$(".g2 img").click(function() {
var albumID = $(this).attr('id');
alert(albumID); //working fine, getting id
$.ajax({
type: 'GET',
url: 'index.php',
//data: x: "albumID",
data: x: albumID,
success: function(data)
{
alert("success!");
}
});
});
});
</script>
What is the wrong which i'm doing? Please help me.
getformat i have mentioned and reply