Salve a tutti.
All'interno di un js eseguo una chiamata POST tramite Ajax
La risorsa richiamata in post restituisce una stringa json
La stringa json è corretta (ho verificato tramite jsonlint), ma nonostante ciò, la pagina aspx mi dice "Invalid JSON", mostrandomi il json che in realtà è valido.
Sto usando il .NET framework 4.
Avete qualche idea?
Grazie mille.
WWW
All'interno di un js eseguo una chiamata POST tramite Ajax
Codice:
$.ajax({
type: 'POST',
url: url,
dataType: "json",
async: true,
success: myFunction,
error: function (xhr, textStatus, error) {
alert(error);
}
});
Codice:
var response = "{\"Documento\":[{\"Tipo_Documento\":\"CARTA IDENTITA'\"},{\"Numero_Documento\":\"12345XY\"},{\"Luogo_Rilascio\":\"ROMA\"},{\"Data_Rilascio\":\"11/10/2008\"},{\"Data_Scadenza\":\"11/10/2018\"},{\"Ente_Rilascio\":\"COMUNE\"}],\"Contatti\":[{\"E-Mail\":\"test@test.com\"},{\"Cellulare\":\"1234567890\"}]}"
HttpResponse r = context.Response;
r.BufferOutput = true;
r.ContentType = "text/x-json";
r.Cache.SetExpires(DateTime.Now.AddSeconds(seconds));
r.Cache.SetCacheability(HttpCacheability.Private);
r.Write(response);
r.Flush();
Sto usando il .NET framework 4.
Avete qualche idea?
Grazie mille.
WWW
Ultima modifica di un moderatore: