I'd love some js/jQuery expert help in code minimization / abstraction. html:
<a href="/account/locations/new?_context=proposal" id="testhref">Test Link</a> js: jQuery(function() { jQuery('#testhref').click(function() { jQuery.ajax({ url: this.href, dataType: "script", beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/ javascript");} }); return false; }); }); I'm trying to minimize the code down to this, since that behavior is something that will be desired in many places. So the js id like to see is something like this: jQuery('#testhref').RemoteLink(options); //where options could be anything additional to pass into the jQuery.ajax call I would plan on handling the document ready state inside there in order to minimize the code needed in setting that up. Is any of this possible? I've tried hard to make it work but my js skills are not allowing me to do so.