Passing a URL Parameter to a Colorbox

ZZaVaddywretty

New Member
I have a simple voting system with a colorbox as the voting form. When a person clicks on vote, it takes them to vote.html?id=X (x being a number). vote.html gets displayed in the colorbox. In the colorbox, I get the URL Parameters, but it does not find id as a parameter. Any idea how to pass id into the colorbox? Here's the code...Javascript:\[code\]<script> function voteForShirt(shirtId) { alert("vote.htm?="+shirtId); $('#').colorbox(); $.colorbox({href:"vote.html?id="+shirtId}); }</script>\[/code\]The following is Javascript from vote.html that appears in the colorbox\[code\]<script type="text/javascript"> function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } var shirtId = getUrlVars()["id"]; alert(shirtId); document.getElementById('title').innerHTML = "<h1>You're Voting for Shirt " + shirtId + "</h1>"; </script>\[/code\]Here when I alert shirtId, I get undefined.
 
Back
Top