Est-ce que quelqu'un sait comment je peux retourner la variable javascript à ajax au lieu de la valeur de chaîne pendant que j'utilise ajax pour appeler le php. S'il vous plaît voir exemple ci-dessous pour plus de détails:Comment retourner une variable javascript à Ajax?
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;
}
Je me demande comment je peux passer 'var ErrorMapping' de php à ajax en tant que variable au lieu de la chaîne –