Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9250031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:20:55+00:00 2026-06-18T10:20:55+00:00

I am trying to call webservice through jQuery but it is not showing any

  • 0

I am trying to call webservice through jQuery but it is not showing any results or errors. My code is:

<script type="text/javascript" language="javascript">
    var empId = '<%= Session["UserName"] %>';
</script>
<script type="text/javascript"> 
    alert(empId);    
    $.ajax({ 
        type: "POST", 
        dataType: "json", 
        contentType: "application/json", 
        url: "ServiceGetUser.asmx/GetEmployee", 
        data: "{'employeeId': '" + empId + "'}", 
        success: function (data) { 
            alert("Employee name: " + data.d); 
        }, 
        error: function () { 
            alert("Error calling the web service.");  
        } 
    }); 
</script>

I’m getting a value from session printing it successfully then passing it to the webservice and in return printing name Jane Developer as shown in my webservice code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

namespace MentorMentee
{
    /// <summary>
    /// Summary description for ServiceGetUser
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class ServiceGetUser : System.Web.Services.WebService
    {

        [WebMethod]
        public string GetEmployee(string employeeId)
        {
            return "Jane Developer";
        }
    }
}

what’s wrong is going on hopes for your suggestions

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:20:57+00:00Added an answer on June 18, 2026 at 10:20 am

    You can put this in doc ready block:

    $(window).load(function(){
       $.ajax({ 
          type: "POST", 
          dataType: "json", 
          contentType: "application/json", 
          url: "ServiceGetUser.asmx/GetEmployee", 
          data: {'employeeId': '<%= Session["UserName"] %>'}, //<-- try it
          success: function (data) { 
              alert("Employee name: " + data.d); 
          }, 
          error: function () { 
              alert("Error calling the web service.");  
          } 
        });
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send SMS using a webservice call. But am having errors
I am trying to invoke webservice using jquery ajax call. I am using jasonp
I'm trying to get a JSON from a webservice with javascript $.Ajax call. <script
I am making a call to a webservice from jquery and trying to return
I am trying to call a webservice. The client was generated with weblogic's ant
I am trying to call a webservice hosted on the local network using https
I'm trying to call an asp.net webservice from the same project it's in: [MethodImpl(MethodImplOptions.Synchronized)]
I'm trying to call a webservice using WinJs.XHR in a windows 8 app; the
I am trying to invoke a WebService through SOAP using Erlang and YAWS (yaws_soap_lib
I'm trying to call a WCF Webservice, from a dll I have made, running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.