0

people. I have Ajax/Jquery to output values from a MySQL table, but I am receiving the values with no commas. Instead of 10,000, I receive 10000. What can I do to fix this?

This is one of the Ajax/Jquery calls code:

$('#red').on('click', function() {
  var colorId = $(this).attr("id");

  $.ajax({
    "url": "tables.php",
    "data": {
      "color": colorId
    },
    success: function(response) {
      response = Number(response);
      $("#redr").text(response);
      console.log(response);

This will pass the variable and output the votes of the "red" color in my MySQL table, which columns are: city, color, votes.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Joe Smith
  • 29
  • 6

0 Answers0