Hello everyone,
I’m new to the Yii Framework and I try to make an Ajax Request.
I need to do an autosave (drafts) functionnality for a messaging system.
But there is a problem, when I do a GET ajax request, it works perfectly
but when I try to make a POST request it says : "POST 400 (Bad Request)"
I tried a simple call with a simple callback like this
compose view (compose.php) :
$.ajax(
{
	url: 'autosave',
	type: 'POST',
	data: {"test":"hello"},
	dataType: 'json',
	contentType: "application/json; charset=utf-8",
	success: function(id)
	{
		console.log('ID : ' + id);
	}
});
MessageController.php :
public function actionAutosave() {
		
	echo $_POST['test'];
}
Thank you for the help 