0

I want to submit a form to a URL appending few values as the querystring.

I am using this to call;

    <form id="form1" method="GET" action="http://abc.appspot.com/_ah/xmpp/message/chat/">
    <input type="text" id="data" />
    <input type="submit" value="Submit" />
    </form>

However, when I click on submit button, the URL that is fired is "http://abc.appspot.com/_ah/xmpp/message/chat/?"

The value of the "data" is not appended. Am I doing something silly here?

Thanks

3
  • 5
    this question hast nothing to do with javascript or jquery. Commented Jan 27, 2012 at 8:49
  • 1
    in what way are you using jquery or javascript here? Commented Jan 27, 2012 at 8:50
  • I am sorry for the confusion. I started off with JQuery first when I started writing this post. Commented Jan 27, 2012 at 9:02

3 Answers 3

3

Only fields which have name attribute are submited. This makes sense because how would you access those values without some key in POST of GET. So change your code to

<input type="text" name="data" id="data" />
Sign up to request clarification or add additional context in comments.

Comments

0

Add name to input text and check

<input type="text" id="data" name="data" />

Comments

0

Give any form elements that are to be submitted a name attribute or they'll be ignored. So:

<input type="text" id="data" name="data" />

(You don't need the id attribute unless you reference it from somewhere else, but it won't hurt.)

Also it probably makes more sense to have method="POST" on your form.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.