Does anyone know how can I return the javascript variable to ajax instead of string value while I using ajax to call the php. Please see below example for more details:
Ajax:
//Ajax Param
var paramList = "Action=make_process";
ajaxRequest = $.ajax({
url: "admin.php",
type: 'POST',
data: paramList,
error: function(){
//error message here
},
success: function(data){
//read return javascript variable here;
}
});
PHP:
public function validationChk()
{
$error_msg['error_msg'][] = array("msg"=>"hello");
$error_msg['error_msg'][] = array("msg"=>"hi");
echo "var ErrorMapping = " . json_encode($error_msg). ";\n\n";
exit;
}