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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:15:39+00:00 2026-06-18T02:15:39+00:00

I am trying to send and return a simple string to a VB.NET web

  • 0

I am trying to send and return a simple string to a VB.NET web method from Javascript using AJAX. Here is the Javascript/jQuery script I am using:

function jQuerySerial() {
//I SET A VARIABLE TO THE STRING I WANT TO PASS INTO MY WEB METHOD
var str = "Hello World";

//AND TRY TO PASS IT INTO MY VB.NET WEB METHOD
$.ajax({
    type: "POST",
    url: "test_WebService.asmx/testWebService",
    data: str,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (e) {
        alert("It worked: " + e);
    },
    error: function (e) {
        alert("There was an error retrieving records: " + e);
    }
});
}//END jQuerySerial

And here is the very simple VB.net Web Method. The Web Method does nothing but get the string and then pass it back to Javascript:

   <WebMethod( )> _
Public Function testWebService(str As String) As String
    Return str
End Function

When I attempt to run this the error: function fires and returns a message saying:

"There was an error retrieving records: [object Object]"

I have many, many other Web Methods in this same Web Service class that manipulate database records and they all work. But, this is the first one I have ever tried to write using the $.ajax syntax and return something to the calling Javascript so I am completely clueless on whats wrong here.

Any suggestions on how to make this work would be appreciated. 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-18T02:15:40+00:00Added an answer on June 18, 2026 at 2:15 am

    It looks like the issue here is that you’re passing a simple string to the Web Service when it is expecting a JSON object. See this article on common issues with jQuery and ASP.NET web services (specifically item 2):

    http://encosia.com/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to send some parameters from a simple android app using AsyncTask<> through
I am trying to send emails from smtps (secure smtp) using Indy and the
I am trying to send a string from a android application to a servlet
I'm trying to send a very basic XML string from a Windows Phone application
I am sending a json string using JQuery.ajax to a php page where I
I am currently trying to send a string to a to a php script
I am trying to use the simple ajax script to webmethod as follows: <script
am trying send an array to php file using $_POST ,still always getting an
I`m trying to send simple html page with form data to user with GET,
I am trying to send an email to customers with html form. here is

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.