Wie Click-Ereignis tot Taste in Zeichenfolge
$.ajax({
\t \t url:'/getArticles',
\t \t method:'GET',
\t }).done(function(articles){
\t \t var content = '';
\t \t articles.forEach(function(e){
\t \t \t var res = "<div class='article'>" +
\t \t \t \t \t \t "<h3>" + e.title + "</h3>" +
\t \t \t \t \t \t "<p>" + e.content + "</p><br>" +
\t \t \t \t \t \t "<button onclick=crud.remove(" + e._id + ")>Remove</button><br>" +
\t \t \t \t \t "</div>";
\t \t \t content += res;
\t \t });
\t \t $('#allarticles').append(content);
\t });
\t window.crud = (function(){
\t \t // Remove an article
\t \t function remove(id){
\t \t \t console.log(id);
\t \t }
Wie kann ich einfügen e._id
richtig hier hinzufügen, so dass es id des Artikels gestellt wird?
Wenn ich auf diese Schaltfläche klicken, um es sagt:
(index):1 Uncaught SyntaxError: Invalid or unexpected token
den Parameter in Anführungszeichen: '"
"' –