Hello,
I have a page where I am displaying a list of users and next to each user - there is "Add as Friend" link.
Now when a user clicks this "Add as Friend" link - I want to call Jquery and submit that request to the backend PHP.
Typically my experience with Jquery involves having a single form in the page and submitting that form via Jquery - Each form has an ID - Using that ID I call the submit function $("#invite_form").submit(function() - I access the form elements this way var emailval = $("#emails").val();
But now here I dont have a form and this friends list is being generated in a loop. So here are the doubts that I have
1) Do I need to create a unique id in the loop for each a href tag
2) How do I change this $("#invite_form").submit(function() - Will it become ("#ahref1").click(function() where ahref1 is the unique id of the href tag
3) How do I access the friend_id field in Jquery function which is present in the href value something like href="/action?friend_id=32"
Not sure if I'm going on the right track Thanks