Czy jest mi ktoś w stanie powiedzieć, czy ten zapis jest zły?:
$("#tableResult").find('tbody')
.append($("<tr onclick="location.href = '@(Url.Action("ShowDetails", "DetailsController"))'">")
.attr('id', 'rowTable' + rowId)
Całą metoda:
function appendResultToTable(advertisementsList) {
$("#tableResult tbody").html('');
for (let advertisementIndex in advertisementsList) {
const rowId = advertisementIndex;
$("#tableResult").find('tbody')
.append($("<tr onclick="location.href = '@(Url.Action("ShowDetails", "DetailsController"))'">")
.attr('id', 'rowTable' + rowId)
.append($('<td>')
.append($('<p>')
.addClass("columnNameAdvertisement")
.append(advertisementsList[advertisementIndex].Name)))
.append($('<td>')
.append($('<p>')
.append('Stan: ' + advertisementsList[advertisementIndex].Condition)))
.append($('<td>')
.append($('<p>')
.append('Cena: ' + advertisementsList[advertisementIndex].Price + ' zł')))
.append($('<td>')
.append($('<p>')
.append('tel. ' + advertisementsList[advertisementIndex].PhoneNumber)))
);
}
}
W konsoli pokazuje się błąd: Uncaught SyntaxError: Unexpected end of input. Występuje on przy onclick="location.href =