czupe
czupe

Reputation: 4919

Parse jquery response (given in array)

I have an ajax call, unfortunately the response arrived in an array (as it seems from firebug).

[-Response-]:

$(server_response) Jquery command gives us:

Object[center, br, <TextNode textContent="\n">, script jquery.js, 
<TextNode textContent="\n">, script, <TextNode textContent="\n">, 
table#megye_tablazat.tablazat, <TextNode textContent="\n\n">, 
input#response_rowid >AAAR7uAAFAAAHY5AAB, <TextNode textContent="\n">, 
input#response_status SUCCESS, <TextNode textContent="\n">]

I need the information of the inputs with id: response_rowid and response_status. If i use:

$(server_response).find('#response_rowid') 

OR

$(server_response).find('#response_status')

It cannot found the needed element (as it seems it is searching only at the center element...), how can i find the simplest way this elements? (#response_rowid,#response_status)

Or should i iterate trough the array? and check the elemnets of the array?

Upvotes: 0

Views: 93

Answers (1)

jantimon
jantimon

Reputation: 38180

Use .filter() jQuery API - filter instead of .find():

Description: Reduce the set of matched elements to those that match the selector [...].

$(server_response).filter('#response_status')

Upvotes: 2

Related Questions