• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking a Boolean Value In JavaScript

 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the following code it fires the load whether projectFlag equals true or false.

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well what you are doing looks to be the correct way to do it, but it is not.

new Boolean("any string") produces true for any string. That means a string that contains false will be evaluated as true

Your only real option here is to do



Eric
 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to pass a boolean value from the servlet back to my JSP using AJAX(jQuery) call?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you eval / new Function it

That will cause more problems than just checking for the string.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic