i am using the code bellow to send a variable to another page but i got "undefined"
<script type="text/javascript">
$(document).ready(function() {
$('.letterz').click(function () {
var selectedletter = $(this).attr("id");
$("#celebdetails").load("reveal.html?surname="+selectedletter, function() {
$('.myloader').fadeOut("fast");
$('#celebdetails').fadeIn("slow");
});
});
});
</script>
my html
<div class="myloader"></div>
<div id="#celebdetails" style="display:none;"></div>
<div class="letterz" id="A"></div>
<div class="letterz" id="B"></div>
<div class="letterz" id="C"></div>
<div class="letterz" id="D"></div>
And in the second page that i am sending the parameter surname i am using the code below to fetch it:
<script type="text/javascript">
$(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);
});
</script>
Thanks in advance