Jump to content

Javascript innerHTML method doesn't show JSON object String property value


Mixaalser684

Recommended Posts

Currently I'm learning Ajax with Java.The innerHTML method works when I'm retrieving simple string data from the servlet, and when I need to update only one HTML element.Since I have the need to update more HTML elements it occurred to me that I can use JSON object with several properties (HTML tag data for each element needed updating).After trying that I've noticed that innerHTML method doesn't work, when I try to process the retrieved data in the Callback function.My question is, why is this happening?Did someone had a similar problem when using JSON with Javascript.Just for the record, when I use innerText method I successfully update the HTML elements with JSON properties data, only they update as text and that's what I don't need. (See the video)

Thank You. Edited by Codenoobalser
Link to comment
Share on other sites

Should be innerHTML, you are using innerHtml in your example
Geeze, talking about case-sensitivity. :facepalm: This raises another question, how do I enable syntax checking for Javascript, in NetBeans IDE, to avoid stupid mistakes like this one in the future? Thanks a million. :)Cheers! Edited by Codenoobalser
Link to comment
Share on other sites

A syntax check wouldn't find that, you can change a property called "innerHtml" if you want to change it, but it's not going to update the HTML content of an element. There's nothing syntactically wrong with using it though, it's not a syntax error.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...