You can manipulate DOM elements in this way, sure, but it probably isn’t the best idea.
Let me summarize what you’re trying to do (to see if I understood everything), then maybe we can find a solution.
You have a link:
<a href="#" data-flavour="Berry" class="nav_link Berry">Berry</a>
When that link is clicked, a get request should be made to a remote PHP script, passing it the data-flavour
attribute of the link, as a “search” query string parameter (?search=Berry
).
Whatever is returned by the PHP script, should then be appended to a div with the id of container
Did I get that right?