$(".male #footwear").click(function(event) {
$.ajax({
url: 'output.php',
data: { gender: 'male', category: 'footwear'},
})
.done(function(data) {
$('section').removeClass('show');
$(".items-list").addClass('show');
$(".items-list .title").text('Male footwear');
$(".items-list .items").text(data);
})
.fail(function() {
console.log("error");
});
});
$(".female #footwear").click(function(event) {
$.ajax({
url: 'output.php',
data: { gender: 'female', category: 'footwear'},
})
.done(function(data) {
$('section').removeClass('show');
$(".items-list").addClass('show');
$(".items-list .title").text('Female footwear');
$(".items-list .items").text(data);
})
.fail(function() {
console.log("error");
});
});
$(".female #clothes").click(function(event) {
$.ajax({
url: 'output.php',
data: { gender: 'female', category: 'clothes'},
})
.done(function(data) {
$('section').removeClass('show');
$(".items-list").addClass('show');
$(".items-list .title").text('Female clothes');
$(".items-list .items").text(data);
})
.fail(function() {
console.log("error");
});
});
var selectCategory = function(gender){
$("#"+gender).click(function(event) {
$('section').removeClass('show');
$("."+gender).addClass('show');
});
}
var loadCategory = function(options){
$("."+options.gender+" #"+slug).click(function(event) {
$.ajax({
url: 'output.php',
data: { gender: gender, category: options.slug},
})
.done(function(data) {
$('section').removeClass('show');
$(".items-list").addClass('show');
$(".items-list .title").text(options.title);
$(".items-list .items").text(data);
})
.fail(function() {
console.log("error");
});
});
}
selectCategory('male');
selectCategory('female');
loadCategory({slug: 'footwear', gender: 'male', title: 'Male footwear'});
loadCategory({slug: 'sneakers', gender: 'male', title: 'Male sneakers'});
loadCategory({slug: 'clothes', gender: 'male', title: 'Male clothes'});
loadCategory({slug: 'footwear', gender: female', title: 'Male footwear'});
loadCategory({slug: 'sneakers', gender: 'female', title: 'Male sneakers'});
loadCategory({slug: 'clothes', gender: 'female', title: 'Male clothes'});