Uffo
Uffo

Reputation: 10056

How to acces jquery object data

So I have an output from an ajax response call

You can view the image here: enter image description here

This is the output from: console.log(data) but I don't know how to access these values? Any help?

Upvotes: 0

Views: 51

Answers (2)

Sushanth --
Sushanth --

Reputation: 55750

You can try

$obj.data('lastId')

Upvotes: 1

jAndy
jAndy

Reputation: 236192

dataset is the HTML5 way to store Node related data. Its pretty much a property that is available on any node and get get accessed like

MyjQueryCollection[ 3 ].dataset.lastId;

You need to grab the underlaying DOM node, you cannot access that property on a jQuery object/collection directly, since it does not get abstracted by jQuery. This is accomplished by referencing the indexed value of the node here.

Upvotes: 5

Related Questions