Hello!
I have an application on Spring MVC and so on the page there is a table with academic subjects and a form for adding a new subject. When you add a new item, it appears in the list without rebooting. But I have an error when inserting a link to the side of the subject name link to edit and delete
Script:
<script> $(document).ready(function () { $('#saveSubject').submit(function (e) { $.post('/university/subjectAdd', $(this).serialize(), function (subject) { $('#subjectsTableResponse').last().append( '<tr>' + '<td align=\"center\">' + subject.title + '</td>' + '<td align=\"center\">' + '<a href=\"c:url value=\'/subject/update/{'+subject.id+'}\'/>' + Редактировать + '</a>'+'</td>'+ '<td align=\"center\">' + '<a href=\"c:url value=\'/subject/delete/{'+subject.id+'}\'/>' + Удалить + '</a>'+'</td>'+ '</tr>' ); }); }); }); The error in the browser is this:
Uncaught ReferenceError: Редактировать is not defined But after reloading the page, everything is OK, I suspect that something is wrong with escaping characters in the link, because if you remove the addition of links and leave just the names of the items, then everything is OK without errors. I want ajax to insert this link in the answer "> Delete How to solve this problem?