Tuesday, February 24, 2015

Passing a Boolean in JQuery

Yesterday, while updating a UI to include a boolean flag controlled by a checkbox, I got stuck. The flag was being persisted, but was not being rendered correctly when fetched from memory. I printed the fetched value in a DIV element. It was printed correctly. Then it hit me. It was a String, and not a Boolean. Upon further investigation, I found out that the value was being persisted as a String and not a Boolean. The JQuery Ajax POST request was sending it as a String. I simply fixed the situation by converting it to a Boolean value before persisting. :)

No comments:

Post a Comment