working on my first webapp, having conflict with this, I hope there is an easy solution :/
I have this profile.html that only have html structure, I fill it dynamically with php and my database, all cool so far.
I have another one search-results.html, which with a bunch of queries 'Post' start building the results depending on the filters... all good so far.
Now the issue, I need to be able to send to my profile.html the right id when the user clicks on a product from the search-results.html, I gave each product a data-product id, the problem is that im stuck, because I just dont know how to open the profile.html when product clicked and somehow let the profile.html which product was actually clicked... here is some code just to make it easier to understand my situation here...
profile.html
$(document).ready(function(){
var num=(Math.random()*3+1);
num=num|0;
num=num.toString();
var n=num.toString();
ajaxPost("Path/get.php", { id : n}, function(result){
var json=JSON.parse(result);
if(json.error==0){
console.log(json);
$('img#fotoProfile').attr('src',json.response.profile_picture);
var nombreFoodtruckConCiudadyPais = json.response.name + " <span class='subtitle'>@" + json.response.cities + "</span>";
$('h2.profile-name').html(nombreFoodtruckConCiudadyPais);
$('#foodtruckName').html(json.response.name);
$('div#descripcion p#descripcionText').html(json.response.description);
$('a#emailText').attr('href',json.response.mail);
$('div#email a#emailText').html(json.response.mail);
$('div#rating p#ratingText').html(json.response.rating);
$('div#categoria p#categoriaText').html(json.response.category);
var origen = json.response.cities + ', ' + json.response.states + ', ' + json.response.countries;
$('div#origen p#origenText').html(origen);
$('div#telefono p#telefonoText').html(json.response.phone);
}else{
alert("Foodtruck Not Found");
}
});
search-results.html on click handler...
$(document).on('click', '[data-idFT]', function(){
var x=($(this).data('idft'));
//What do I do here?
});
Basically im stuck right there. My x should be my n on my profile.html ajaxPost id : n...
I hope I can get some aid, im new to webapps... thanks in advance.