Using Jquery to submit a form and run with Cakephp Baked Pages

I found a simple solution for submitting a form using jquery + ajax. One that was compatible with CakePHP.
You need to create a from with an ID.

<?php echo $form->create('Test',array('url' => 'edit/', 'type' => 'get','id' => 'TestID'));?>

Then bind a listener to the form submit

// do an ajax from instead
$('#TestID').submit(function() {

var inputs = [];
$(':input', this).each(function() {
inputs.push( + '=' + escape(this.value));

data: inputs.join('&amp;amp;amp;'),
url: this.action,
timeout: 2000,
error: function() {
console.log("Failed to submit");
success: function(r) {

// return false
return false;

This will work with checkboxes, input fields, selects but not upload file types.
It will create a get string and send the request to the form action using ajax.
CakePHP usually uses $this->data in its baked pages. As it is now a get request, I will now be using $this->params.
If you want to use Cake’s baked pages, just add this ternary operator to the beginning of the corresponding methods.

$this->data = isset($this->params['url']['data'])?$this->params['url']['data']:$this->data;