Comment on Tutorial - Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers By Nicholas C. Zakas



Comment Added by : mehr

Comment Added at : 2011-05-11 10:22:46

Comment on Tutorial : Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers By Nicholas C. Zakas
Hey,

I am having a peculiar problem with getting an integer from an ajax response. Whenever I call the following code, parseInt(data) returns NaN despite data being a string.
function(data) //return information back from jQuery's get request
{

$('#progress_container').fadeIn(100); //fade in progress bar
$('#progress_bar').width(data +"%"); //set width of progress bar based on the $status value (set at the top of this page)
$('#progress_completed').html(parseInt(data) +"%"); //display the % completed within the progress bar
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. I liked it.
View Tutorial          By: savitha at 2011-05-06 02:23:46

2. My friend, How to user ArrayList?
View Tutorial          By: Joao Neto at 2009-06-04 06:28:17

3. Thanks a lot for this great post.
View Tutorial          By: Ram Para at 2012-03-23 17:07:09

4. Excellent Example to explain the functions
View Tutorial          By: manish at 2010-08-05 03:10:43

5. Thanks for this nice comparision table for Spring
View Tutorial          By: guddu at 2009-10-17 03:08:59

6. it absolutely very usefull for me
Thanks

View Tutorial          By: sudhir Kr Singh at 2012-07-24 05:17:52

7. nice
View Tutorial          By: srfds at 2012-05-28 09:25:15

8. Why not a simple array list of threads?
wha

View Tutorial          By: Ranadheer Machineni at 2011-08-18 12:30:35

9. In good form, don't forget to add column headers a
View Tutorial          By: Jake at 2009-07-13 14:20:16

10. How can i add all the values of an multidimensiona
View Tutorial          By: jolly at 2015-04-11 11:54:47