I've spent today researching how to save data using an ajax request in cakephp and have got now where, the documentation on the cakephp website seems a bit lacking for this particular topic.
I have several sortable lists and I need to save the position of each list item when one is sorted. I have an ajax request set up as follows that is triggered when an item is moved:
$.ajax({
url: "/orders/save_column_order",
type:"POST",
data:"data="+data
});
and the referenced function in the controller is:
function save_column_order(){
if($this->RequestHandler->isAjax()){
SAVE STUFF...
}
}
I have the helpers etc. set up:
var $helpers = array('Html','Form','Js');
var $components = array('Session','Email','RequestHandler');
And its not working...
So my questions are:
1) What is the current url for sending an ajax request to an action in a controller? Is it simply /controller/action?
2) What else do I need to do to the controller to access the ajax data?
BONUS:
3) Is there a way to include a custom php file in the CakePHP framework that references the database settings so I can manually update my mysql database?