I want to send a unique value to a variable when I click on a link.
I want to send a unique value to the postIdvariable below:
function uploadphoto(){
$.get('page.asp?postId=postIdvariable&id=' +
response.id);
}
Im looping out the links from the database, that call the function so I have:
<a href="#" onClick="uploadphoto(); return false;">Upload photo 1</a>
<a href="#" onClick="uploadphoto(); return false;">Upload photo 2</a>
<a href="#" onClick="uploadphoto(); return false;">Upload photo 3</a>
So how can I send one value from photo link 1, another from photolink 2 etc?
Option 1: Ouput your id as the argument to the function:
JS
HTML
Option 2 (recommended): Use an html id or classname:
JS
HTML