Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel _ Public Class EmbedJS Inherits System.Web.Services.WebService _ Public Function fnFetchDetails() As ListDictionary Dim jsonObj As New ListDictionary Try jsonObj.Item("fname") = "Krishna" jsonObj.Item("lname") = "Chaitanya" jsonObj.Item("city") = "Hyd" jsonObj.Item("state") = "Andhra" jsonObj.Item("country") = "India" Return jsonObj Catch ex As Exception jsonObj.Item("Error") = "Error at server" Return jsonObj End Try End Function _ Public Function fnUpdateDetails(ByVal obj As ListDictionary) As String Try 'Retrieving values from object, which was passed from client. Dim sFirstName As String = obj.Values(0) Dim sLastName As String = obj.Values(1) Dim sCity As String = obj.Values(2) Dim sState As String = obj.Values(3) Dim sCountry As String = obj.Values(4) 'Perform your save operations here... Return "Data updated successfully!" Catch ex As Exception Return "Error at server" End Try End Function _ Public Function fnDataSetToJSON() As ArrayList Dim arr As New ArrayList Try Dim i As Integer = 0 For i = 0 To 2 Dim jsonObj As New ListDictionary jsonObj.Item("name") = "foo" + i.ToString jsonObj.Item("city") = "bar" + i.ToString arr.Add(jsonObj) Next Return arr Catch ex As Exception arr.Add("Error at server") Return arr End Try End Function _ Public Function fnFetchDetailsClass() As Person Dim objPerson As New Person Try objPerson.FirstName = "Krishna" objPerson.LastName = "Chaitanya" objPerson.City = "Hyd" objPerson.State = "Andhra" objPerson.Country = "India" Catch ex As Exception End Try Return objPerson End Function End Class