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 7046561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:39:54+00:00 2026-05-28T02:39:54+00:00

I am trying to call a Web Method of service from a Jquery Ajax

  • 0

I am trying to call a Web Method of service from a Jquery Ajax call.
Method accepts 3 parameter from the front end and search for the record in the DB.

I am not able to concatinate those 3 parameter properly in the Ajax call :

The Web Method is :

public bool FindRecord(string Fname, string Lname, string Email) 
{
    string SQL = "SELECT * FROM contactsSource WHERE (first_name ='" + Fname + "') AND (last_name = '" + Lname + "') AND (email_address_work = '" + Email +"')";
    OleDbDataReader reader = DataAccess.GetData(SQL);
    if (reader.HasRows)
    {
        return true;
    }
    else
    {
        return false;
    }
}

and the Ajax call I am trying is :

   <script type="text/javascript">
        $(document).ready(function() {
            $('#btnDownload').click(function() {
                var Fname = $('#Fname').val();
                var Lname = $('#Lname').val();
                var email = $('#Email').val();

                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    data: '{"Fname":"' + Fname + '", "Lname":"' + Lname + '", "Email":' + email + '}',
                    url: "WebService.asmx/FindRecord",
                    dataType: "json",
                    success: function(result) {
                        alert(result.d);
                    },
                    error: function(result) {
                        alert("Due to unexpected errors we were unable to load data");
                    }
                });
                //$('.secondary').show(500);
            });
        });    

    </script>

But I am keep on getting 500 Internal Server error :

{"Message":"Invalid JSON primitive: (Email ID that I am passing).","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()
  • 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-28T02:39:55+00:00Added an answer on May 28, 2026 at 2:39 am

    Your email parameter should be enclosed in double quotes, otherwise it will not be parsed properly as a JSON string value. The corrected syntax should be:

    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: '{"Fname":"' + Fname + '", "Lname":"' + Lname + '", "Email":"' + email + '"}',
        url: "WebService.asmx/FindRecord",
        dataType: "json",
        success: function(result) {
            alert(result.d);
        },
        error: function(result) {
            alert("Due to unexpected errors we were unable to load data");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call a web service from an ajax jquery. It is
I am trying to call the GetReportParameters method from the ReportingServices2005.asmx web service from
I'm trying to figure a method of securing a web service call with AJAX.
I am trying to call a web service from asp.net 3.5 application. I have
I'm running into this problem when trying to call a SOAP Web Service from
Trying to call a SAP SOAP Web Service from a generated sudzc app shows
I am trying to make a web service call from PHP to a SOAP
I am trying to call a SharePoint web service from Acrobat JavaScript, and I
I'm new for Jquery. I'm trying to call server method from my user control
I'm trying to call a RESTful web service from an Android application using the

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.