Skip to content

Instantly share code, notes, and snippets.

@ludwigmair
Forked from helhum/UsingAjaxUrl.html
Created September 11, 2016 06:54
Show Gist options
  • Save ludwigmair/b0a3f062b23e15acceef5b01536b7b7f to your computer and use it in GitHub Desktop.
Save ludwigmair/b0a3f062b23e15acceef5b01536b7b7f to your computer and use it in GitHub Desktop.
Using TS rendering
{namespace t=Helhum\TyposcriptRendering\ViewHelpers}
<button class="ajax-button" data-ajaxUri="{t:uri.ajaxAction(action: 'foo', controller: 'bar') -> f:format.htmlentities()}">
Click Me
</button>
<script type="text/javascript">
jQuery.ajax(
jQuery(".ajax-button").data("ajaxUri")
).done(
function(result) {
console.log(result);
}
);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment