What's the best way to convert this:
<a href="#" onclick="saveFavorite('345', 'user@user.com');> Favorite</a>
To a cl开发者_开发知识库ean/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="user@user.com">Favorite</a>
$(".addtofavorite").click(function(evt) {
evt.preventDefault();
var id = this.id;
var value = this.value;
saveFavorite(id,value);
});
精彩评论