473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

got value of "NaN"

77 New Member
hello all, i have an error value / "NaN" value that's i;m not expecting of..

this is i how i check the for the value that's become "NaN"


Expand|Select|Wrap|Line Numbers
  1. new Ajax.Request(base_url+'finance_control/cbh/recalculate_items', {postBody: Form.serialize('newcbhForm'), onComplete: function(transport) {
  2.             data = transport.responseText.evalJSON();
  3.             $('item_amount').innerHTML = data.amount;
  4.             max_cashbnknourut = parseInt(data.max_cashbnknourut);
  5.             if (isNaN(max_cashbnknourut) || isNaN(max_cashbnknourut)){
  6.                 alert("Nan error");
  7.             }
  8.         }})
the max_cashbnknour ut is digit/numeric (0..10).
When i got "NaN" value, how can i make the value of max_cashbnknour ut become digit/numeric again??tks

regards,

maminx
Aug 11 '08 #1
11 4832
gits
5,390 Recognized Expert Moderator Expert
could you tell what data.max_cashbn knourut is right after the eval?

kind regards
Aug 11 '08 #2
maminx
77 New Member
could you tell what data.max_cashbn knourut is right after the eval?

kind regards

yes that's right, actually i've already use that script logic to another functionality/module, and it's works well...but i have no idea when i;m using that logic/ script for another module, it's get NaN value...

help please, any idea???

when the "max_cashbnknou rut" got NaN value, how can i reset the value become integer or the value of "max_cashbnknou rut" after it's casting with parseInt ?
Aug 11 '08 #3
gits
5,390 Recognized Expert Moderator Expert
just put an alert after the eval-line and alert data.max_cashbn knourut ... it cannot be NaN when it could be parsed to int ... may be data.max_cashbn knourut is undefined? ...

kind regards
Aug 11 '08 #4
maminx
77 New Member
could you tell what data.max_cashbn knourut is right after the eval?

kind regards

//max_cashbnknour ut before parsing is 1;
max_cashbnknour ut = parseInt(data.m ax_cashbnknouru t);
//max_cashbnknour ut after parsing is NaN;
Aug 11 '08 #5
maminx
77 New Member
just put an alert after the eval-line and alert data.max_cashbn knourut ... it cannot be NaN when it could be parsed to int ... may be data.max_cashbn knourut is undefined? ...

kind regards

the "max_cashbnknou rut" is undefined when it's not cast with parseInt.
Aug 11 '08 #6
gits
5,390 Recognized Expert Moderator Expert
the problem is not max_cashbnknour ut that seems to be a global in your code ... but the data.max_cashbn knourut ... i assume it is just missing in your responseText ... you replace the global value 1 with an undefined value ...

kind regards
Aug 11 '08 #7
maminx
77 New Member
the problem is not max_cashbnknour ut that seems to be a global in your code ... but the data.max_cashbn knourut ... i assume it is just missing in your responseText ... you replace the global value 1 with an undefined value ...

kind regards

my investigation is i always got NaN value after i make parseInt of "max_cashbnknou rut", before i;m casting the max_cashbnknour ut, the value is 1, and after i make

max_cashbnknour ut = parseInt(data.m ax_cashbnknouru t)

the value of max_cashbnknour ut is become "NaN"

idea please??
Aug 11 '08 #8
gits
5,390 Recognized Expert Moderator Expert
parseInt(data.max_cashbnknou rut) returns NaN in your case !!! ... so just check your Ajax-Response first! you assign NaN to your variable ... it is not a problem of parseInt ... it MUST be a problem of your Ajax-response ...

kind regards
Aug 11 '08 #9
maminx
77 New Member
parseInt(data.max_cashbnknou rut) returns NaN in your case !!! ... so just check your Ajax-Response first! you assign NaN to your variable ... it is not a problem of parseInt ... it MUST be a problem of your Ajax-response ...

kind regards

yes of course my problem value of NaN is only in my case, i;m sorry the problem is not in parseInt of course...

when i read your message above, i just realize that the problem is in AJAX, and i figure out the solving..it;s in controller that called the AJAX function...

anyway, thanks a lot, you had give me an idea, superb !!

kind regard, maminx
Aug 11 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2666
by: Boštjan Jerko | last post by:
Hello ! I need to know if the result of math formula is nan (Not a number). How can I do that? Thanks, B.
6
2656
by: asmirnov1234567890 | last post by:
Hi my python 2.3.4 for windows refuse to execute line float("NaN"). It says: >>> float("NaN") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for float(): NaN
24
3590
by: hjbortol | last post by:
Hi! Is the expression "a >= b" equivalent to "a - b >= 0" in C/C++? Is this equivalence an IEEE/ANSI rule? Or is this machine/compiler dependent? Any references are welcome! Thanks in advance, Humberto.
59
4568
by: Pierre Quentel | last post by:
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in My script didn't work in some cases and I eventually found that for v = 0 the test returned True So I changed my test for the obvious "if type(v) is bool", but I still find it confusing that "0 in " returns True
5
4187
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent accident" etc...) The issue appears possibly to point to a bug in the Python compiler, with it producing inconsistent results. I'm using "Python 2.4.2...
8
9254
by: fredo | last post by:
This question was asked in comp.lang.javascript with no result. In IE5.x and IE6, I want to display an image when the user rolls over a text link. The image does indeed display, but only on the first rollover. It seems that the image height and width become set to zero after the image is displayed once; or perhaps that the...
29
2409
by: Java script Dude | last post by:
Greetings, Now I can understand that 0 equal false, but should "" also equal false? Apparently the answer is yes. When I test both Firefox and IE, they both say ""==false . I assume this goes back to the original spec for JavaScript. Not very intuitive but I guess I can code around this.
2
5563
by: ems9tech | last post by:
I can't get this count to return a number without an empty quote at the end ( " ) or getting NaN. Does anyone know why? I've searched and don't see any other postings on this issue. I'm using VS 2008. Thanks for any and all pointers!!! XML file: <?xml version="1.0" encoding="utf-8"?> <CFF...
9
2611
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.