Giter Site home page Giter Site logo

football-transfer-window-analysis's People

Contributors

nassosstylianou avatar

Watchers

 avatar

football-transfer-window-analysis's Issues

The player name problem

/* When I do just this, I get the name of only the first player.
$("#playerNames").html(value.player_name);
But if I actually call value. player_name, I get all the player names from the selected team back into the console */
console.log(value.player_name);

Are you sure that you're getting the name of the first player and not the last player? I think what's happening is that the contents of the div are being rewritten every time it goes over the $.each loop - so you're left with only the last one. It looks like it works in the console because it doesn't overwrite what's in the console, it keeps the history.

/* If I comment the first bit out and go just with the code below so instead if I actually try to iterate through the player names, I find I am iterating through each letter in the name (but it does access all names, even if one letter at a time). I assume that the length is the length of all letters together, but still a little weird. */
var playerName = '';
for(i=0; i < value.player_name.length; i++){
playerName += value.player_name[i] + "<br>";
}
$('#playerNames').append(playerName);

I'm surprised this is doing each one letter by letter, but I reckon it's because you've got a for loop within the each loop. So value.player_name must equal a name and value.player_name[i] must equal a letter? It gets all the names in the end because you are using $('#playerNames').append rather than $("#playerNames").html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.