Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:49:29+00:00 2026-06-15T18:49:29+00:00

My question is about to float number in jquery. I looked other questions about

  • 0

My question is about to float number in jquery. I looked other questions about it in this site but I couldn’t find which I look.

In part of my code, I used $.post in jquery. I send request to database and fetch data as json format. In my database, some numbers’ format is like 345,54565000000. So, I want to float numbers 5 digit after comma.

Part of my code is :

$.post("http://localhost/ajax.php",
      function(data) {
          var listdata;
          $.each(data, function(i,item){

              listdata += "<td>"+item.number+"</td>";

          });

            $(".result).empty().html(listdata);

    },"json"
);

Some of my trials are like:(which is not worked)

1.)

var number = (item.number).toFixed(5);
listdata += "<td>"+number+"</td>"; 

2.)

var number=item.number;
var new_number = number.toFixed(5);
listdata += "<td>"+new_number+"</td>"; 

Thank you for your replies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:49:30+00:00Added an answer on June 15, 2026 at 6:49 pm
    var number = 345.54565000000​;
    
    var parsedNumber = parseFloat(parseInt(number*100000,10)/100000);
    

    FIDDLE;

    If that seperator is in fact a comma, you’ll have to replace it with .replace(',', '.')

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there is many question about it but i can not find
I checked and could find numerous posts about performance of float vs double (
To all: I have a question about converting from string to float in python
This question is about how to read/write, allocate and manage the pixel data of
This may be a stupid question, but I'm interested in the performance of using
I read up on this article about Perlin Noise and have a few questions
Hello i got a question about jQuery ajax post request in ZendFramework here is
I have a question about drawBitmap. android.graphics.Canvas.drawBitmap(Bitmap bitmap, float left, float top, Paint paint)
Here's another question about Django. I have this code: views.py cursor = connections['cdr'].cursor() calls
I have a question which arose from another question about precision of floating numbers.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.