Hi experts
I'm using jquery with a html page.
Right now I'm adding an image to my page my using .prepend like this.
var myimage = $('<a href="
http://www.google.com"><img class="testclass" src="Images/testimage.jpg"
/></a>');
$('.TestDiv1').prepend(myi
mage);
This image is added correctly to my page and the hyperlink works. It takes me to:
http://www.google.com
What is the syntax to add some parameter to the url that are stored in a variable?
So i would have these variables
var parameter1 = "apple"
var parameter2 = "peach"
But I need the syntax to add these variables to this url in the snippet below:
var myimage = $('<a href="
http://www.google.com"><img class="testclass" src="Images/testimage.jpg"
/></a>');
$('.TestDiv1').prepend(myi
mage);
so I want the hyperlink url to go to:
http://www.google.com&apple&peach
Anyone know the syntax?
Open in new window
The simplest way to add the variables to the URL is to hard code them.Open in new window
But I imagine the variables are variable, so you would need to concatenate the URL string.Open in new window