Jump to content

Submitting Via Js Function


davej

Recommended Posts

So as a newbie I'm finding that sending a message to the server from a JS function requires a little deviousness. The approach I'm testing is to insert a text input inside a blank form using innerHTML immediately before issuing a submit for that form. Is that a reasonable approach or is there a better way? Thanks.

Link to comment
Share on other sites

If you're submitting a form then that's one way to do it. You could also use hidden inputs so they don't show up on the page, or change the URL of the action to add your variables there. You could also use ajax instead of submitting a form if that fits your situation.

Link to comment
Share on other sites

If you're submitting a form then that's one way to do it. You could also use hidden inputs so they don't show up on the page, or change the URL of the action to add your variables there. You could also use ajax instead of submitting a form if that fits your situation.
Oh... type hidden? I have not tried that one. Maybe that is what I want? I am working my way through a boilerplate AJAX example that had me confused. http://www.w3schools.com/tags/tag_input.asp
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...