The scenario is to send the clicked link text to server where i have kept images of the text say (caps) in a file system(images/caps/thumbnails) and the paths are saved in mysql database with this table desc
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| imgid | int(11) | NO | PRI | NULL | auto_increment |
| imgurl | varchar(75) | YES | | NULL | |
| family | varchar(20) | YES | | NULL | |
+--------+-------------+------+-----+---------+----------------+
3 rows in set (0.04 sec)
with that text php retrieve all the images(say 50 images) via mysql from the file system opens products.html in new tab and display it there with that 50 images.
plz go throgh the whole code which i have in my pages and then reply
below is my menu bar code in my index.html.
<ul class="dropdown">
<li><a href="#">Man</a>
<ul class="sub_menu">
<li><a href="#">Caps</a></li>
<li><a href="#">Shirts</a></li>
<li><a href="#">T-shirts</a></li>
<li><a href="#">Jeans</a></li>
</ul>
</li>
<li><a href="#">Woman</a>
<ul class="sub_menu">
<li><a href="#">Caps</a></li>
<li><a href="#">Coats</a></li>
<li><a href="#">Shirts</a></li>
<li><a href="#">Tshirts</a></li>
<li><a href="#">Jeans</a></li>
</ul>
</li>
</ul>
with below code i m grabbing the text if a user clicks the caps link the txt is grabbed below the alert is working but the $.ajax……no
$(document).ready(function() {
$('ul.sub_menu a').click(function() {
var txt = $(this).text();
//alert("you clicked"+txt);
$.ajax({
type: 'POST',
url: 'thegamer.php',
data: {'txt':txt}
});
});
});
further in my thegamer.php it is not get passed to this code as i m echoing it but not getting echoed
<?php
include 'dbconnect.php';
$q=$_GET["txt"];
echo $q;
include 'dbclose.php';
?>
further with the clicked link text the php pulls with this query pulls the relevant images
select * from images where family='$q'
REMEMBER I DONT WANT THE AJAX TO RETRIEVE THE IMAGES OF CAPS AND DISPLAY ON THE SAME INDEX.HTML BUT TO OPEN A NEW WINDOW TAB WITH PRODUCTS.HTML AND DISPLAY THE IMAGES THERE
from further on here then how to play with that txt and retrieve images from the file system with mysql paths and further displaying that 50 images in products.html inside a divs i am completely blank i tried all the stackoverflow relevant questions and google but cant get an idea and process it
anyone please help me to go on further with code
try with this:
OR with your code:
note that
send_txtis a post variable which you can get with like$_REQUEST['send_txt'], hope it will work