i am using the code bellow to send a variable to another page but i got "undefined"
$(document).ready(function() {
$('.letterz').click(function () {
var selectedletter = $(this).attr("id");
$("#celebdetails").load("reveal.html?surname="+selectedletter, function() {
$('.myloader').fadeOut("fast");
$('#celebdetails').fadeIn("slow");
});
});
});
my html
And in the second page that i am sending the parameter surname i am using the code below to fetch it:
$(document).ready(function() {
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
var me = getUrlVars()["surname"];
alert(me);
});
Thanks in advance