views:

13

answers:

2

Hi,

Should I use in this case method="post" or method="get" for ajax form submission?

Update: When should be used post and when get in case of ajax form submission?

<form  action="script.php" method="post">
  <label>Url: </label> 
  <input value="http://" id="url-input" type="text" size="100" /><br />
  <label>paste html file source: </label><textarea rows="10" cols="60"></textarea><br />
  <input type="checkbox" checked /> parse links<br />
  <input type="checkbox" checked /> parse images<br />
  <button type="submit" id="submit-html">Submit</button>
</form>

Thanks

+1  A: 

Well if you're pasting HTML source code, you're definitely going to want to use POST so you don't end up with a million characters in the request URI using GET... I'd say any time you use a textarea, you should be posting the data.

animuson
+2  A: 

Refer here for a complete explanation:

When do you use POST and when do you use GET?

Leniel Macaferi
+1 for the really good link. The answer to the question POST vs GET is independent of AJAX. The only interesting thing is if you "change" something.
Raffael Luthiger