TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amir kamal
NA
32
1.7k
Problem in onkeyup event
Feb 3 2020 9:22 AM
looking for help, I have 2 onkeyup events but both are conflicting each other.
1.I can populate product detail by entering Product Id , but when i enter the User Id to populate Users name in "Name" field the products field becomes blank and also name of user dont appeares.
2.If i comment out get getUser() then getProduct() function fine and vice versa.But both function togeather having issue which i mentioned above.The code and snapshot is attached.
Please help
<script>
Function to get user
var
user;
function
getUser() {
var
uid = $(
"#UserId"
).val();
$.ajax({
type:
"POST"
,
contentType:
"application/json; charset=utf-8"
,
url:
"/Products/getUserById"
,
data: JSON.stringify({ UserId: uid }),
success: onSuccess
});
}
function
onSuccess(us) {
user = JSON.parse(us);
if
(user) {
$(
"#FullName"
).val(user.FullName)
}
else
{
user = {};
$(
"#FullName"
).val(
''
)
}
}
Function to get product
var
prod;
function
getProduct() {
var
id = $(
"#ProductId"
).val();
$.ajax({
type:
"POST"
,
contentType:
"application/json; charset=utf-8"
,
url:
"/Products/getProductById"
,
data: JSON.stringify({ ProductId: id }),
success: onSuccess
});
}
function
onSuccess(res) {
prod = JSON.parse(res);
if
(prod) {
$(
"#ProductName"
).val(prod.ProductName)
$(
"#Description"
).val(prod.Description)
$(
"#Amount"
).val(prod.Amount)
}
else
{
prod = {};
$(
"#ProductName"
).val(
''
)
$(
"#Description"
).val(
''
)
$(
"#Amount"
).val(
''
)
}
}
function
SetProduct() {
var
disc = $(
"#Discount"
).val();
var
qty = $(
"#Qty"
).val();
var
TotalAmount;
$(
"#invoice_body"
).append(
'<tr><td>'
+ prod.ProductName +
'</td><td>'
+ qty +
'</td><td>'
+ prod.Description +
'</td><td>'
+ prod.Amount +
'</td><td>'
+ disc +
'</td><td>'
+ TotalAmount +
'</td></tr>'
)
}
</script>
Reply
Answers (
4
)
Microsoft.Extensions.Configuration.Abstractions?
HttpContext does not contain definition of?