Wednesday, 15 February 2012

javascript - Pass image id to php mysql query via jquery -



javascript - Pass image id to php mysql query via jquery -

i need pass image id mysql query.

for that, have done these coding. results in undefined index x: referenced many stackoverflow answers. nil 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 wrong i'm doing? please help me.

if(isset($_get['x'])) { echo $_get['x']'; }

replace with

if(isset($_get['x'])) { echo $_get['x']; }

extra ' there

if issue still there check url should somthing this

index.php?x=sometext

javascript php jquery mysql ajax

No comments:

Post a Comment