2
I have the JS code below and the return of JSON does not assign the value to variable texto
. I did a test with alert(data.frase)
and the message came normally.
Would anyone know why to go texto
does not receive the value of data.frase
?
var texto=null;
var cod = { cod: codFrase };
$.ajax({
url: "/Motivos/Getfrase",
type: 'Post',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(cod),
success: function (data) {
if (data.success) {
texto = data.frase;
}
}
});
Thank you
You checked the value of
data.success
, if it istrue
?– Tiago S
where Voce is checking whether the text content has changed or not?
– andrepaulo
Are you sure that the result that comes from the server is exactly a phrase with the phrase name? Debugged to ensure?
– Raul José Chaves