Jump to content

Having trouble with AJAX on Java and Javascript


spoonraker

Recommended Posts

Basically the page I'm working on now is coded in Java/JSP using Struts and using AJAX in quite a few places.90% of the AJAX is just a simple matter of when you check a box it automatically writes the data to the MySQL database so you don't have to check the box, then hit a submit. All of those work fine.The part that's giving me trouble is on one particular button (well two) that has a bit more functionality than the rest. The website at the top displays a lot of data about an affiliate, and one section is a Welcome Letter that you can customize and save to use as a general form for all affiliates. Below it is a "I have sent NAME a welcome letter" checkbox. When this box is checked/unchecked another box at the bottom of the page which is basically a duplicate of the first checkbox should be checked/unchecked, the boolean checked or unchecked should be saved to the database for the button, and if the button is checked the welcome letter section of the website should be hidden, or reappear if it is unchecked, along with a quick link to the welcome letter section at the top of the page.Basically everything is working except for the hiding of the welcome letter section. The other box checks/unchecks right along with it, and the link at the top of the page disappears and reappears as it should.For some reason though whenever I include the welcome letter block of code weird stuff happens. Most of the time it will disappear just fine, but when it reappears with the box being unchecked it will be stuck at the very top of the page instead of toward the middle where it should be. Sometimes it won't hide when the box is checked, and then when it's unchecked a second welcome letter is stuck in the page, again in the top at the wrong place.The AJAX script I am using basically looks for duplicate id <span> tags and updates everything within them when the javascript function retrieveURL(URL, StrutsFormBean) is called.Just like everything else, the welcome letter is setup similar to the following<span id="ID"><%JSP condition that will only allow the section to be displayed if certain conditions are met{%>some html and a struts form with lots of struts junk<%}%></span><span id="ID"></span><input type=button onclick=retrieveURL(url that makes jsp condition change, formbean)>...any ideas?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...