Get the value of an attribute Jquery
Posted
by
Abu Hamzah
on Stack Overflow
See other posts from Stack Overflow
or by Abu Hamzah
Published on 2012-04-11T17:23:15Z
Indexed on
2012/04/11
17:28 UTC
Read the original article
Hit count: 201
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
© Stack Overflow or respective owner