Home > Back-end >  Laravel blade 3 levels quote issue
Laravel blade 3 levels quote issue

Time:05-25

Anyone know what's wrong with the following quote structure?

onclick="showMemberList('{{ $result[\'_id\'] }}')"

I am getting the following error:

syntax error, unexpected '"_id\"]); ?>"' (T_CONSTANT_ENCAPSED_STRING), expecting identifier (T_STRING)

I thought my structure is correct already where I escaped the ' wrapping _id

CodePudding user response:

It does not need to escape the _id quotes:

onclick="showMemberList('{{ $result['_id'] }}')"
  • Related