[gameprogrammer] Re: POST in JSON format?

  • From: Michael Croghan <mcroghan@xxxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Wed, 23 Jan 2013 21:48:46 -0800

Serialize the form and post it?

Post an input element which the value is a JSON string?

Please elaborate specifically what you are trying to do.

<form id="form-element-id">
...
<input type="button" id="action" name="button" value="button" />
</form>

<script type="text/javascript">
//<![CDATA[
$jQuery(function() {
  $jQuery("#action").click(function() {
jQuery.ajax ({
type: "POST",
url: "<url you are posting to>",
data: jQuery("#form-element-id").serialize()
}).done(function(data){
if (console && console.log)
console.log (data);
});
});
//]>
</script>

On Wed, Jan 23, 2013 at 9:19 PM, Kevin Jenkins <gameprogrammer@xxxxxxxxxx>wrote:

> Does anyone know how to do an HTML form POST using JSON format? I searched
> online but couldn't find any clear explanations or source-code that
> actually worked.
>

Other related posts: