Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. calling a webservice through javascript

calling a webservice through javascript

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptquestion
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saqib82
    wrote on last edited by
    #1

    Hi Can someone tell me what are the pros and cons of calling a web-service through JavaScript instead of calling a web-service through c# or vb.net??? Regards

    sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

    K V 2 Replies Last reply
    0
    • S saqib82

      Hi Can someone tell me what are the pros and cons of calling a web-service through JavaScript instead of calling a web-service through c# or vb.net??? Regards

      sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

      K Offline
      K Offline
      Khan Bangash
      wrote on last edited by
      #2

      <%@ WebService Language="VB" Class="Samples.AspNet.SimpleWebService" %> Imports System.Web Imports System.Web.Services Imports System.Xml Imports System.Web.Services.Protocols Imports System.Web.Script.Services Namespace Samples.AspNet _ _ _ Public Class SimpleWebService Inherits System.Web.Services.WebService _ Public Function EchoInput(ByVal input As String) As String Dim inputString As String = Server.HtmlEncode(input) If Not String.IsNullOrEmpty(inputString) Then Return String.Format("You entered {0}. The " + _ "current time is {1}.", inputString, DateTime.Now) Else Return "The input string was null or empty." End If End Function 'EchoInput End Class 'SimpleWebService End Namespace This is asmx File and this is aspx file <%@ Page Language="VB" %> body { font: 11pt Trebuchet MS; font-color: #000000; padding-top: 72px; text-align: center } .text { font: 8pt Trebuchet MS } Simple Web Service // This function calls the Web Service method. function EchoUserInput() { var echoElem = document.getElementById("EnteredValue"); Samples.AspNet.SimpleWebService.EchoInput(echoElem.value, OnSucceeded); } </x-turndown>

      S 1 Reply Last reply
      0
      • K Khan Bangash

        <%@ WebService Language="VB" Class="Samples.AspNet.SimpleWebService" %> Imports System.Web Imports System.Web.Services Imports System.Xml Imports System.Web.Services.Protocols Imports System.Web.Script.Services Namespace Samples.AspNet _ _ _ Public Class SimpleWebService Inherits System.Web.Services.WebService _ Public Function EchoInput(ByVal input As String) As String Dim inputString As String = Server.HtmlEncode(input) If Not String.IsNullOrEmpty(inputString) Then Return String.Format("You entered {0}. The " + _ "current time is {1}.", inputString, DateTime.Now) Else Return "The input string was null or empty." End If End Function 'EchoInput End Class 'SimpleWebService End Namespace This is asmx File and this is aspx file <%@ Page Language="VB" %> body { font: 11pt Trebuchet MS; font-color: #000000; padding-top: 72px; text-align: center } .text { font: 8pt Trebuchet MS } Simple Web Service // This function calls the Web Service method. function EchoUserInput() { var echoElem = document.getElementById("EnteredValue"); Samples.AspNet.SimpleWebService.EchoInput(echoElem.value, OnSucceeded); } </x-turndown>

        S Offline
        S Offline
        saqib82
        wrote on last edited by
        #3

        Thanks to provide the code. But my question was to tell me the advantages as well as disadvantages of calling a web-service through JavaScript. If you know then please write them here. Regards

        sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

        D 1 Reply Last reply
        0
        • S saqib82

          Thanks to provide the code. But my question was to tell me the advantages as well as disadvantages of calling a web-service through JavaScript. If you know then please write them here. Regards

          sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

          D Offline
          D Offline
          DavidNohejl
          wrote on last edited by
          #4

          Hmm, no postback?


          "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

          H 1 Reply Last reply
          0
          • D DavidNohejl

            Hmm, no postback?


            "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

            H Offline
            H Offline
            Haissam
            wrote on last edited by
            #5

            You cant achieve this using javascript, you have to use AJAX for this purpose

            Best Regards, Haissam Abdul Malak My Blog

            D 1 Reply Last reply
            0
            • H Haissam

              You cant achieve this using javascript, you have to use AJAX for this purpose

              Best Regards, Haissam Abdul Malak My Blog

              D Offline
              D Offline
              DavidNohejl
              wrote on last edited by
              #6

              AJAX stands for Asynchronous Javascript And XML, duh.


              "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

              H 1 Reply Last reply
              0
              • D DavidNohejl

                AJAX stands for Asynchronous Javascript And XML, duh.


                "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

                H Offline
                H Offline
                Haissam
                wrote on last edited by
                #7

                Really?? how smart!! u have said it ASYNCHRONOUS JAVASCRIPT, and the libraries used in ajax are not by default for javascript, please learn more and then post your comment. DUHH

                Best Regards, Haissam Abdul Malak My Blog

                1 Reply Last reply
                0
                • S saqib82

                  Hi Can someone tell me what are the pros and cons of calling a web-service through JavaScript instead of calling a web-service through c# or vb.net??? Regards

                  sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

                  V Offline
                  V Offline
                  Vasudevan Deepak Kumar
                  wrote on last edited by
                  #8

                  http://www.codeproject.com/soap/marcelo888RemoteScript01.asp[^]

                  Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups