Sign in
Join
.NET
About
Learn
Architecture
Docs
Downloads
Community
ASP.NET Forums
/
General ASP.NET
/
jQuery for the ASP.NET Developer
/
Delete records in ASP.NET MVC using JavaScript to call ActionResult D...
/
Re: Delete records in ASP.NET MVC using JavaScript to call ActionResu...
View Complete Thread
Shortcuts
Active Threads
Unanswered Threads
Unresolved Threads
Support Options
Advanced Search
Reply
bruce (sqlwo...
All-Star
58174 Points
15650 Posts
Re: Delete records in ASP.NET MVC using JavaScript to call ActionResult Delete(int id)
Apr 20, 2019 07:37 PM
|
bruce (sqlwork.com)
|
LINK
Your jquery is looking for an element with the tag name of this. Try:
var id = $(this).attr("id")
Also the code should be:
<a href="#" id=“@post.NewsId” onclick="promptDelete();">
bruce (sqlwork.com)
All-Star
58174 Points
15650 Posts
Re: Delete records in ASP.NET MVC using JavaScript to call ActionResult Delete(int id)
Apr 20, 2019 07:37 PM|bruce (sqlwork.com)|LINK
var id = $(this).attr("id")
Also the code should be:
<a href="#" id=“@post.NewsId” onclick="promptDelete();">