Bonjour groupe,

J'ai une requête JSON qui me cause problème. J'ai fait quelques correctifs suite à ma lecture de quelques post, mais j'ai toujours un problème de serialization.

ma requête :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
function LancerCallAjax() {
                    var a = $("#TextBox1").val();
                    var b = $("#TextBox2").val();
                    $("#TextBox2").val("waiting");
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json",
                        url:"AjaxCall.aspx/Sum",
                        data: '({a: ' + a + ', b: ' + b+ '})',
                        success: function (data) {alert(data);}
                        });
                }
L'exception :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
{"Message":"Invalid JSON primitive: .","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer
Ma méthode SUM :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<System.Web.Services.WebMethod()> _
        Public Shared Function Sum(ByVal a As String, ByVal b As String) As String
            Dim ares, bres As Integer
            Dim at, bt As Boolean
 
            at = Integer.TryParse(a, ares)
            bt = Integer.TryParse(b, bres)
 
            If at AndAlso bt Then
                Return (ares + bres).ToString
            Else
                Return "Something is wrong"
            End If
        End Function
Quelqu'un a une idée?

Merci!