Torna al Thread

$.ajax({ type: 'GET', // mettevo POST!!! e ho dovuto abilitare il metodo GET sul Web Service contentType: 'application/json; charset=utf-8', // se non metto questo non funziona il Web Service (BOH!) dataType: 'json', cache: false, traditional: true, url: 'http://www.donnaperfetta.com/ws/dp.asmx/test', success: function(dati){ // utilizzo queste istruzioni per leggere e pubblicare i dati // leggo dati.d non so perchè ma probabilmente dipende dal formato con cui il Web Service restituisce i dati var str = JSON.parse(dati.d); // scorro l'array (table è il nome della tabella che ho dato nel dataset nel Web Service) for(i=0;i<str.table.length;i++){ // scrivo il codice HTML $("body").append("<div>Nome: "+str.table[i].nome+"</div>"); } }, error: function(dati){ $("body").html("Errore! "+dati.status+' '+dati.statusText); } })
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5