Good morning,
I'm trying to append a couple of parameters to an href and can't get it to work - the parameters just don't get appended.
Here's the html showing a button the user clicks which launches a js script that validates the users responses to several questions. If the responses are valid the js then updates a couple of variables - blapp and tspapp. These are then appended to an href and the link is clicked by js. Everything seems to be working except that the parameters are not appended to the href.
I tried two different ways, one was to use an embedded script with document.write, that didn't work and the other was to use jQuery append and that didn't work either...sigh.
Here's the html showing the button and immediately below it the document.write code that I commented out and below that the link that I tried to append using jQuery.
Here's the js that validates responses and updates the values of the two parametersCode:<input id="continue" type="button" value=" Continue " onclick="checkAnswers();" /> <!-- <a id="appLink" href="http://www.hollisterairshow.com/rally/vendorApp.php?<script>document.write("blapp="+blapp+"&tspapp="+tspapp)</script>"></a> --> <a id="appLink" href="http://www.hollisterairshow.com/rally/vendorApp.php?"></a>
The complete page can be seen here http://www.hollisterairshow.com/rallyCode:<script> function checkAnswers() { if(selling === "omitted" || tsp === "omitted" || (selling === "yes" && curbl === "omitted")) { dispMessage(); return; }; alert("All OK so set up link to vendor app"); if (selling === "yes" && curbl ==="no") { blapp = "yes"; } else { blapp = "no"; }; if (tsp === "yes") { tspapp = "yes"; } else { tspapp = "no"; } alert("blapp="+blapp+" tspapp="+tspapp); var params = "blapp="+blapp+"&tspapp="+tspapp; alert("params = " + params); $( "#appLink" ).append(params); document.getElementById('appLink').click(); } function dispMessage() { alert("Please check your answers and press <Continue> again"); return; } // /checkAnswers </script>
Thanks for any assistance you can provide.
Tony



Reply With Quote

Bookmarks