Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.ratingCallback = function(data){
- if(data[0].code == 3){
- ratingHTML = buildHTML(0);
- console.log('a'+ratingHTML);
- return;
- }
- ratingHTML = buildHTML(data[0].rating);
- console.log('b'+ratingHTML);
- return;
- };
- function buildHTML(pageRating){
- for(counter = 1; counter <= 5; counter++){
- if(counter == pageRating){
- ratingHTML += '<input name="star1" type="radio" class="star" value="'+counter+'" checked="checked"/>';
- } else {
- ratingHTML += '<input name="star1" type="radio" class="star" value="'+counter+'"/>';
- }
- }
- return ratingHTML;
- }
- $.getJSON("https://domain.com/"+data+"?jsoncallback=?");
- console.log(ratingHTML+"WHY DOES THIS EXECUTE FIRST AND NOT AFTER THE CALLBACK SINCE IT IS PLACED AFTER getJSON????");
Add Comment
Please, Sign In to add comment