I'm currently in the process of creating a HTTP web service that will return data in JSON, XML and String formats. When entering a string and pressing "JSON Search" it will return data back from a database stored in Google SQL. However when I press the "JSON Remove" button next to the "JSON Search" button the data is cleared and then reappears after a few seconds. a br tag between the buttons seems to resolve the issue but messes around with the layout which I don't want to happen.
Code is within the linked image
The default type
of a <button>
is "submit". You have explicitly set your JSON Search button to be a submit button, but technically so is your Remove button. Add the attribute type="reset"
to have that one be a button that actually clears the form. Or type="button"
if you just don't want it to do anything except run your event handler.
The problem right now is that you probably have a handler that is clearing the data when you click the Remove button, but since it's an (unintended) submit button, it's also kicking off another query.