I am building a backoffice to a certain site, and here i need to delete the comments from the database using ajax, the problem is i cant pass the id i want to hide after deleting to jquery in ajax. following is the code for the comments:
<% foreach (var item in Model) { %>
">
Comment
<%: Html.DisplayFor(modelItem => item.Text) %>
Date
<%: Html.DisplayFor(modelItem => item.Date) %>
<% } %>
this is the code for the controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Deletecomment(int id)
{
cr.Delete(cr.getComment(id)); //cr is the conx to the repository
cr.Save();
return View("Index");
}
this is my jquery
function deleteRow() {
var url_ = this.url.split("/");
$("#row" + url_[url_.length - 1]).remove();
}
what i have done is taken the url and split it to take the id of the entry in db then add it to the form as id and then remove that id, but i am sure there is a better solution
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)