0
I’m making an ajax request with jquery and Php like this:
// arquivo php
$json = array(
"status"=>"true",
"message"=>"inserido com sucesso"
);
echo json_encode($json);
.
// arquivo js
$.ajax({
url, url,
type: "post",
data: dados,
success: function(json){
console.log(json);
},
error: function(){
msg.text("Erro ao fazer requisição");
}
});
My console.log
return {"status":"true","message":"inserido com sucesso"}
and wanted to be transformed into a Java Script array, as I could do this conversion ?
Just add the attribute
dataType: "json"
to your AJAX request.– Woss
worked thanks, you think I’d better close the question ?
– RickPariz