Get the value of an attribute Jquery
- by Abu Hamzah
i am trying to get EmployeeId withitn the DOM something like this:
var o = obj[$(this).attr("EmployeeId")];
but getting undefined
when i debug i see the following:
$(this)[0].data
data "{EmployeeId: 'A42345'}"
here is my source code:
$.ajax({
type: "POST",
url: url,
data: "{EmployeeId: '" + id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var obj = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
var o = obj[$(this).attr("EmployeeId")]; //<<<<undefined