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
sangeetha k
NA
207
51k
The datas are coming inside the ajax call but it is undefine
Apr 13 2018 3:25 AM
$(document).on('click', '#btnEdit', function () {
debugger;
var empID = $(this).attr('data-id');
$.ajax({
type: 'POST',
url: '/Employee/UpdateOrEditEmployee',
data: "{Empid:'" + empID + "'}",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (data) {
debugger;
if (data == 0 || data == null) {
debugger;
data.length == 0;
//clear();
$('#txtEmpID').val();
$('#txtEmpName').val();
$('#txtDesignation').val();
$('#txtEmpimage').val();
$('#txtSalary').val();
$('#txtEmail').val();
$('#txtDepartment').val();
}
else if (data.length!=0 && data!=0) {
debugger;
var Empid = data.Empid;
var EmployeeName = data.Empname;
var Designation = data.Designation;
var Empimage = data.Empimage;
var Employeesalary = data.Salary;
var Department=data.Department;
if (Empid != null) {
$('#txtEmpID').val(Empid);
}
if (EmployeeName != null) {
$('#txtEmpName').val(EmployeeName);
}
if (Designation != null) {
$('#txtDesignation').val(Designation);
}
if (Empimage != null) {
$('#txtEmpimage').val(Empimage);
}
if (Employeesalary != null) {
$('#txtSalary').val(Employeesalary);
}
if (Employeesalary != null) {
$('#txtEmail').val(Employeesalary);
}
if (Department != null) {
$('#txtDepartment').val(Department);
}
}
$("#EditModal").modal('show');
},
failure: function (data) {
alert("Failed");
},
error: function (data) {
alert("error");
}
});///it is not taking the value but the value is coming couldnt able to assign it to the var empid,empname and all in ajax call
Reply
Answers (
6
)
y ajax method is hittingthe action method
Communication Simulation with Objects in C#