jQuery, get datas in AJAX (done) then, display them as star (error) -


i'm using star rating, 100% working except when insert values javascript :

example : http://www.gamer-certified.fr/test.html

    <script type="text/javascript"> jquery(document).ready(function() {   jquery.ajax({       type: "get",       datatype: "jsonp",       url: "http://www.gamer-certified.fr/export/widget.php",       data: {demandeur: "esl" },       cache: true,        success: function(data, textstatus, xmlhttprequest){          var obj = null, length = data.length;         (var = 0; < length; i++) {              widget = "<span class='stars'>"+(data[i].qualite / 2)+"</span>" // automatic not working             widget = "<span class='stars'>4</span>" // manually not working             jquery('#gamer-certified'+i).html(widget);             }         }  }); }); </script> 

the thing working putting directly data in span value outside widget +=

<span class="stars">4</span> // working when directly put on html side 

example : http://www.gamer-certified.fr/test.html

thanks !

to find out why manually entered data works , data receive not, need figure out different between manual data , entered data. timing of jquery event? formatting of data? once find difference, make sure address using correct means.

edit: based on review of code, $.stars() call happens on $(document).ready(), while content retrieved after that. call `$.stars() in callback, not before.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -