Hi everyone.
I have a module and i wrote a simple ajax call on click event, i would like to get some dat from controller with this call.
I have no errors but in ajax success function i can’t get the message from controller’s function
module/controller/BackEndAjaxController.php
public function actionGetSpecificUserData()
{
if( !empty( $_POST["id"] ) )
{
print $_POST["id"]; exit;
//echo $_POST["id"]; exit
}
}
javascript
$(".details").click(function(){
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: baseUrl+"ControlPanel/BackEndAjax/getSpecificUserData",
data: ({"userid" : id}),
dataType : 'text'
}).done(function( msg ) {
alert( "Data Saved: " + msg );//here only alert "Data Saved" without msg
});
})
i am sorry for my English