0

I am trying to access object filed values that are passed from twig to javascript.

 <a href data-user_data="{{ users|json_encode }}">

With:

var userData = $(this).data('user_data');

var myJSON = JSON.stringify(userData);

returning

{}

Tried:

var myJSON = JSON.parse(subscriptionData);

Got:

Uncaught SyntaxError: Unexpected token o in JSON at position 1

Non of the posts from the site did not help..

joopeerr
  • 183
  • 1
  • 1
  • 12

0 Answers0