facebook

JS loop

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #343271 Reply

    Yann
    Member

    Hello
    i don’t understand, i parse a remote xml like this

    
    <marker iduser="7" type="green"/>
    <marker iduser="8" type="red"/>
    <marker iduser="9" type="green"/>

    and i have this function:

    var xml = data.responseXML;
            var markers = xml.documentElement.getElementsByTagName("marker");
            for (var i = 0; i < markers.length; i++) {
        
              var iduser = markers[i].getAttribute("iduser");
              var type = markers[i].getAttribute("type");
              
              if (type=='red') 
                {
                console.log(' user '+iduser);
                db.transaction(function (tx) {
                    tx.executeSql('SELECT * FROM Alertes WHERE userid = ?', [iduser], function(tx, results){
                          console.log('Result found for '+iduser+' = '+ results.rows.length);
                          //return results.rows.length;
                    });
                });
                }
              
        
            }

    So, my first console return iduser = 8 (OK) but my sql request return iduser=9 !!!
    i don’t understand why
    any idea?
    thanks
    Yann

    #343295 Reply

    Hi Yann,

    I took a quick look at it. Need to analyze it a bit closer. If we can’t figure it out from code analysis we will request to access to your project code.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: JS loop

You must be logged in to post in the forum log in