I get the error: "SyntaxError: expected expression, got '&'", What is the root cause of this? I don't know what to do
Hello,
I'm building with PHP an HTML string and then I want to put it in the html of the div (On this moment I don't know anymore how this called, sorry):
- jQuery('#searchresults').html(<?php echo htmlspecialchars('<table id="table_id" class=""><thead><tr><th></th><th></th><th>voornaam</th><th></th><th>Achternaam</th><th>Volledige naam</th><th>Categorie</th></tr></thead><tbody>'); ?>);
I have bring it back to just a simple hardcoded string.
In my console.log I get the message: SyntaxError: expected expression, got '&', and I don't see it in my div.
The result in the code of webdevelopment tools is:
- jQuery('#searchresults').html(<table id="table_id" class=""><thead><tr><th></th><th></th><th>voornaam</th><th></th><th>Achternaam</th><th>Volledige naam</th><th>Categorie</th></tr></thead><tbody>);
I'm using firefox as browser.
I can't find how to solve it. If I google than I find the same message only with the difference as in my case the character '&'.
When I get this working than the next step will be to replace with HTML string which I will create PHP and remove the linebreaks and white spaces.
I hope that someone can point me in the right direction.
Thanks in advance.
Nico