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. cout<<5+"object orinted programming
View Tutorial          By: SANDEEP SHARMA at 2011-09-18 19:06:57

2. i have a question..i need to parse an xml file wit
View Tutorial          By: meltd0wn at 2011-09-30 08:36:51

3. How do I insert an image in a list? I am using Vis
View Tutorial          By: anu at 2010-04-16 03:07:00

4. hello
thanks for your code. Please could an

View Tutorial          By: Bruno at 2009-05-28 15:38:46

5. Hi Friends.... This code is working correctly with
View Tutorial          By: kasi at 2009-11-25 23:52:56

6. i want full of information abt java
View Tutorial          By: sagar at 2010-08-23 06:42:40

7. Thank you
View Tutorial          By: dara at 2009-12-19 02:46:52

8. hi can u send me the complete working code for sen
View Tutorial          By: gautami at 2007-12-04 01:13:45

9. i hav d same error as sudhir has "INVALID PO
View Tutorial          By: JAY SHAH at 2011-02-14 09:33:12

10. top notch
View Tutorial          By: anu at 2010-03-15 01:46:38