user2066808
user2066808

Reputation: 3

How to get a value from an object returned by ajax

I'm doing something that should be fairly simple but I can't figure out how to get a certain value from the object that is returned by an ajax request.

This screenshot should explain it.

I just need to be able to get the text returned where "Private video" is.

Upvotes: 0

Views: 50

Answers (2)

WooCaSh
WooCaSh

Reputation: 5212

I'm not sure but:

The text and xml types return the data with no processing. The data is simply passed on to the success handler, either through the responseText or responseXML property of the jqXHR object, respectively

and

jqXHR.done(function(data, textStatus, jqXHR) {});

so I think it is correct:

$.ajax({
  url:..
}).done(function(data, txtStatus, jqXHR){
   console.log(jqXHR.responseText);
});

Check this and give me feedback.

Upvotes: 2

karthikr
karthikr

Reputation: 99660

In the success response, you can get the response data, and access the responseText

$.ajax({
  url:..

  success: function(data){
     alert(data.responseText);
  }
});

Upvotes: 2

Related Questions