use filter in javascript code #117

lukeman83 opened this Issue Feb 4, 2013 · 3 comments


None yet

3 participants


what is the best way to use filters into javascript code?


All you'd need to do is generate correct url, I suggest trying filters in templates to see how the url looks like and replicating generation of url in javascript


I recently used a filter in javaScript like this

function f(response) {
  var rurl = '{{ 'PLACEHOLDER' | apply_filter('my_thumb') }}';
       rurl = rurl.replace(PLACEHOLDER, response.url);
  $('#images').append('< img src="' + rurl + '" alt="" />');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment