Jump to content
Mixaalser684

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

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...