What's the best way to convert this:
<a href="#" onclick="saveFavorite('345', '[email protected]');> Favorite</a>
To a clean/reusable ajax call with jquery?
What's the best way to convert this:
<a href="#" onclick="saveFavorite('345', '[email protected]');> Favorite</a>
To a clean/reusable ajax call with jquery?
not sure what you mean by convert...
you can always add id and class to your href like so you can reuse it accross app
<a id="345" class="addtofavorite" href="#" value="[email protected]">Favorite</a>
$(".addtofavorite").click(function(evt) {
evt.preventDefault();
var id = this.id;
var value = this.value;
saveFavorite(id,value);
});