Parsing XML with jQuery... problem retrieving elements

An XML snippet:


And here's my testing code, just to show whether data is being collected or not ('data' holds the XML):

var element;

$(data).find('review').each(function() {
    element = $(this).find('name').text();


Now here's the problem, only this query actually returns data:


The alert box in this case would pop up with '4'. These two other queries don't return anything (the alert box is blank):


I've tried using jQuery selectors, like...

$(this).find('game > name').text();

...but that doesn't work, either, still get a blank alert box. Am I missing something? Testing is being done in Chrome.


Try something like this:

assuming that in xml you have the xml document

$(xml).each(function (index, item) {
    $reviews = $(item).find('review');

    //assuming that you have more than one review in results
    $reviews.each(function (i, rev) {
        var api = $(rev).find('api_detail_url').text();
        var $game = $(rev).find('game');
        var gameApi = $game.find('api_detail_url').text();
        var gameID = $game.find('id').text();
        var gameName = $game.find('name').text();                     



Need Your Help

How to cross compile alljoyn standard core and service framework?

c++ c++11 arm cross-compiling alljoyn

I have one wifi camera with armv5 processor and want to cross compile and alljoyn standard core, service framework and want to make notification producer application.

Cross domain JSONP AJAX - "Uncaught SyntaxError: Unexpected token"

jquery ajax json cross-domain jsonp

I am building a simple app for a platform called Mixi, which is like Facebook in Japan. Now, in the Javascript API I am trying to fetch user's profile information as per given API and after passing...