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. its very good , good example for beginners
View Tutorial          By: Rohit Mumbai at 2012-02-03 06:59:13

2. There is better way to fix this problem..
<

View Tutorial          By: Sundara Kaku at 2011-07-23 10:38:52

3. can any body help to get the code for receiving SM
View Tutorial          By: ash at 2008-05-15 01:07:19

4. concept of static keyword is beautifully explained
View Tutorial          By: jaideep aswal at 2012-04-14 07:21:56

5. i need some more basic programes in java
View Tutorial          By: nivin at 2012-10-19 09:14:27

6. super......... thanks 4 ur great example...
View Tutorial          By: jithinraj at 2013-03-13 08:34:07

7. thanks for your explanation, but for desired outpu
View Tutorial          By: bismillah at 2010-09-02 10:16:09

8. i want to study c-programming language
View Tutorial          By: rajesh at 2008-07-27 07:43:09

9. The code gives the following exception :-
<

View Tutorial          By: Lourdu Felix at 2009-01-26 03:37:53

10. where is the main class dear.................
View Tutorial          By: akhand at 2011-03-01 23:58:05