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

  • Home
  • SEARCH
  • 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 3874554
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:09:54+00:00 2026-05-19T22:09:54+00:00

function EmpCode(empCode) { var queryString = ; var hasQuerystring = document.URL.indexOf(‘?’); if (hasQuerystring !=

  • 0
function EmpCode(empCode) {
    var queryString = "";
    var hasQuerystring = document.URL.indexOf('?');
    if (hasQuerystring != -1) {
        queryString = document.URL.substring(hasQuerystring + 1, document.URL.length);
        if (queryString == 'id=1') {
            $.ajax({
                type: "POST",
                url: "EmployeeBasicInfo.aspx/CheckEmpCode",
                data: "{'empCode':" + empCode + "}",// Sending empCode which is a string
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    var errorMsg = (msg.d);
                    if (errorMsg != 'NA') {
                        alert(errorMsg);
                    }
                }
            });
        }
    }
}

Here is my WebMethod

[WebMethod]
public static  string CheckEmpCode(string empCode)
    {
    string empCod = "";
    EmployeeFactory empFactory = new EmployeeFactory();
    empCod = empFactory.CheckCode(empCode);
    return empCod;
}

When i send the empCode as ‘11479’ 0r any integers from Ajax the web method is calling. when i send the empcode as “C1026” or any string with characters then the webmethod is not getting called..

Please suggest me how to pass empCode which is having string value.

  • 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-05-19T22:09:55+00:00Added an answer on May 19, 2026 at 10:09 pm

    Put quotes around the EmpCode.Currently you are sending:

    data: {'empCode': C1026}
    

    You need to send:

    data: {'empCode': 'C1026'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function addFav(id){ $.ajax({ url: misc/favAdd.php, type: POST, data: { mode: 'ajax', user: id}, dataType:
function validateRequiredFields(formid) { var inputs = document.getElementsByClassName('required'); for(i=0;i<inputs.length;i++) { var FieldID = inputs[i].id; if(
function runProcess(){ var todo = items.concat(); setTimeout(function(){ process(todo.shift()); if(todo.length > 0){ setTimeout(arguments.callee, 25); }
function ExChgClsName(Obj,NameA,NameB){ var Obj=document.getElementById(Obj)?document.getElementById(Obj):Obj; Obj.className=Obj.className==NameA?NameB:NameA; } <a href=javascript:showMenu(2);> i am a newbie of the
function contentDisp() { $.ajax({ url : a2.php, success : function (data) { $(#contentArea).html(data); }
function loaded() { document.addEventListener('touchmove', function(e){ e.preventDefault(); }); myScroll = new iScroll('scroller'); } document.addEventListener('DOMContentLoaded', loaded);
function json (url){ $.getJSON(url, function(data) { return data; }) } this function don't see
function redirect($url){ header(HTTP/1.1 303 See Other); header(Location: $url); exit(); } I have the function
function simple_form($form_state) { $form['item'] = array('#type' => 'hidden', '#value' => 'some_value'); $form['#action'] = 'http://external-website.com/';
function manageVoting() { $(div.votemaincontainer).each(function () { // variable Declaration and intialization. var myRating =

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.