Call Web Service with AJAX
Web Development
1
Posts
1
Posters
0
Views
1
Watching
-
Hello I have web service solution in Visual Studio with one parameter :
Public Function CheckPalletInLocation(location As String) As String
Dim ScaleConnnection As New SqlClient.SqlConnection("MYCONNEXION") Dim ScaleCommand As New SqlClient.SqlCommand ScaleCommand.Connection = ScaleConnnection ScaleConnnection.Open() ScaleCommand.CommandText = "SELECT DISTINCT LOGISTICS\_UNIT FROM LOCATION\_INVENTORY WHERE LOCATION = '" & location & "'" Return ScaleCommand.ExecuteScalar() ScaleConnnection.Close() 'Return "True" End Function
When I launch solution, webservice works. It return value. Now I want to call it in HTML page with ajax code :
TEST WEB SERVICE PAGE function Click\_BB() { $.ajax({ type: 'post', url: 'https://localhost:44341/WebService1.asmx?op=CheckPalletInLocation', contentType: "application/xml", data: { location: '110-01-03-10' }, success: function (d) { alert(d); }, failure: function (response) { debugger; alert(response.d); } }); }
I always have this error in the response page :
soap:ReceiverSystem.Web.Services.Protocols.SoapException: Le serveur n'a pas pu traiter la demande. ---> System.Xml.XmlException: Données non valides au niveau racine. Ligne 1, position 1.
I transale : server cannot process. Invalid data root, line 1 position 1
Can someone help please ?
Thanks