Jump to content

Submitting Via Js Function


davej
 Share

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

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
 Share

×
×
  • Create New...