I'm .load() 'ing some code from a different file, inside this file is a form:
echo $this->Form->create('myForm', array('url' => array('controller' => 'myController', 'action' => 'myAction'), 'id' => 'myForm'));
//my input fields
echo $this->Form->end;
I wanted to be able to submit this form so I used:
$('#table').on('click', '#mySubmitButton', function() {
$('#myForm').submit();
});
When I now click #mySubmitButton the form is rediecting to myAction but $this->request->data is empty. When I manually point my browser to the file that I'm loading the form works fine, it just wont post the data it gets .load() 'ed
Is this a common problem? And what can I do to get the form to submit properly?
Thanks
.load() code:
$(document).ready(function () {
$('#table1').load('link_to_file');
});
HTML output of the form:
<form id="myForm" accept-charset="utf-8" method="post" action="link_to_file"></form>