Je veux publier des données à un service Web avec ajax. il est mon code ajax:Ajax erreur post
function Looping() {
var Grid = document.getElementById("<%= gvHastalar.ClientID %>");
var Row;
var Cell;
if (Grid.rows.length > 2) {
for (i = 1; i < Grid.rows.length - 1; i++) {
Row = Grid.rows[i];
Cell = Row.cells[3];
alert(Cell.innerHTML);
var html = $.ajax(
{
type: "POST",
url: "http://localhost:7753/HastaTahlilUyariServisi.asmx/f_HastaninAktarilacakAlislabTestleri",
data: "{_sTcKimlikNo:" + Cell.innerHTML + ",_iKlinikKodu:18001,_bAy:12,_iYil:2009}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: alert('success'),
error: alert('error')
}
).responseText;
Row.style.backgroundColor = "#D3EFD1";
}
}
}
Et le code de ma fonction webservice est ici:
[WebMethod]
[SoapHeader("_ticket", Direction = SoapHeaderDirection.In)]//SoapHeaderDirection.Out
public DataSet f_HastaninAlisLabTahlilleri(string _sTcKimlikNo, int _iKlinikKodu, byte _bAy, int _iYil)
{
try
{
string QSelect =
@"SELECT * FROM [V_EUCLID_SONUC]
WHERE MONTH(KAYITTARIHI) = " + _bAy + @"
AND YEAR(KAYITTARIHI) = " + _iYil +
AND TCKIMLIKNO = '" + _sTcKimlikNo + @"'";
return dbA.ExecuteDataSet(CommandType.Text, QSelect);
}
catch (Exception ex)
{
throw (ex);
}
}
Il y a un point de rupture sur la fonction qui est au service Web, mais debug ne vont jamais ce point de rupture. J'ai collé l'url de webservice du navigateur mais peut être url est faux. Et quand je cours le projet, j'ai 3 alerte. Texte de première cellule son normal.Second alerte est succès et la dernière alerte est erreur. Je souhaite envoyer des paramètres à f_HastaninAlisLabTahlilleri et à l'ensemble de données de retour utilisateur. Comment puis-je faire ceci?
Merci à l'avance
Quoi? Faux. Pour obtenir des instructions, consultez http://msdn.microsoft.com/en-us/library/0twaftwz.aspx. –