It's not quite clear what you call appropriate data in your question, but doesn't the retail id suffice? You don't need javascript for this. When generating your link, you could pass along this retailer id:
@foreach (var retailer in Model.Retailers)
{
<div>
@retailer.Name
... some info
@Html.ActionLink(
"some link text",
"someAction",
"someController",
new { retailerId = retailer.Id },
null
)
</div>
}
and inside the corresponding controller action you could use this retailer id to do whatever you were intending to do:
public ActionResult SomeAction(int retailerId)
{
...
}
UPDATE:
Once possibility is to use an AJAX request to send the retailer id to your controller action when the link is clicked. For that you will need the retailer id. You could use an HTML5 data-* attribute on the anchor:
<a href="retailerURL.com" target ="_blank" class="retailer" data-retid="123" data-url="@Url.Action("SomeAction")">anchor-Link-retailer3</a>
and then you could use jQuery to subscribe to the click event of all those links and send the AJAX request:
$(function() {
$('.retailer').click(function() {
var url = $(this).data('url');
var retailerId = $(this).data('retid');
$.post(url, { retailerId: retailerId });
});
});
UPDATE 2:
Another possibility is to perform the redirect to the retailer website inside your controller action. This way you don't need AJAX:
@Html.ActionLink(
"some link text",
"someAction",
"someController",
new { retailerId = retailer.Id },
new { target = "_blank" }
)
and inside the controller action update the database, fetch the retailer website and redirect:
public ActionResult SomeAction(int retailerId)
{
// TODO:
// 1. fetch the retailer website given the id:
// 2. update the database with the info
// 3. redirect to the retailer website
string retailerWebsite = ...
return Redirect(retailerWebsite);
}