mercredi 9 mai 2018

Missing values in ajax response

I want to call a URL with jQuery and parse only one value from the HTML I get as response. The problem is that the span-tag, where the value should be, is empty.

$.ajax({
          url: url,
          success: function(data) {
            var parser = new DOMParser();
            var responseDoc = parser.parseFromString(data, "text/html");

            console.log(responseDoc);

            var score = responseDoc.getElementById('score');
            console.log('Score: ' + score.innerHTML);
          }
        });

Does anybody know if and how I can get the value?

Aucun commentaire:

Enregistrer un commentaire