Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
The id is not defined jquery error MVC 5
Mani Kandan
Jan 10 2017 4:01 AM
343
Reply
Hello every one,
I am working on mvc5 with visual studio 2015. I am using products.js file and called this products.js file on _Layout.cshtml page as shown below,
I have added this jquery code,
passproductid = {
passid:
function
() {
$(
'.edit_product'
).on(
'click'
,
function
(e) {
debugger
;
var
_productId = $(
this
).attr(
'id'
);
$.ajax({
url:
'/ProductCategory/GetProducts/'
,
type:
"POST"
,
data: { productid: _productId.substring(10) },
success:
function
(data) {
$(
'#divresult'
).html(data);
}
});
});
}
}
after I have called this jquery function throught table tr click to get row id like this,
@foreach (
var
item
in
Model)
{
<tr id=
"
[email protected]
"
onclick=
"return passproductid.passid()"
class
=
"edit_product"
>
but getting this error,
How can I solve this?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to append the array to a legend in Jqplot?
Load the link in a div tag