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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:18:28+00:00 2026-05-16T01:18:28+00:00

Basically I have a site where I want the user to input something, have

  • 0

Basically I have a site where I want the user to input something, have it go to the server for processing and then return it asynchronously, load the contents into a div and then fade it in with jQuery. What is the best way to the do accomplish this?

Currently here is my “solution”:

$(document).ready(function () {
    $('#output-box').hide();
    $('#form1').submit(function () { 
        $.ajax({
            type: "POST",
            url: "Default.aspx/ParseData",
            data: "{ $('#txtInput').val() }",
            success: function (msg) {
                $('#output-box').text(msg).fadeIn();
            }
        });
        return false;
    });
});

It doesn’t work – just returns the contents of Default.aspx. So how do I properly send the contents of #txtInput to the ParseData function in Default.aspx.vb? Also, is this the best way to accomplish something like this? Should I even need to use jQuery to send the data, or should I simply call the function and have it grab the data server-side, put in the information in the result div, and then show it using jQuery?

Also, I’ve found similar questions (and have asked a similar question myself) but I haven’t been able to make it work yet..

  • 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-16T01:18:29+00:00Added an answer on May 16, 2026 at 1:18 am

    In addition to the other suggestions, you need to set a contentType of application/json on the request. You also need to set a dataType of json to be sure jQuery interprets the response correctly.

    $.ajax({
      type: 'POST',
      url: 'Default.aspx/ParseData',
      data: '{ "strUserInput" : ' + $('#txtInput').val() + ' }',
      dataType: 'json',
      success: function (msg) {
        // If ASP.NET 2.0:
        $('#output-box').text(msg).fadeIn();
    
        // If ASP.NET 3.5+:
        $('#output-box').text(msg.d).fadeIn();
      }
    });
    

    See this post for more info on the .d issue there: http://encosia.com/2009/02/10/a-breaking-change-between-versions-of-aspnet-ajax/

    The server-side method should be defined like this:

    [WebMethod]
    public static ParseData(string strUserInput)
    {
      return "Message";
    }
    

    This post covers it all pretty well: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/

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

Sidebar

Related Questions

I have a merchandising web site that allows user to buy stuff on my
we are running a click-to-call service, my idea is basically like this: website have
I'm creating a new site and I want the users to be able to
I am redoing the navigation bar that is included several dozen of my site's
I'm struggling to work out how best to do what I think I want
I just started a drupal blog, found here but extremely rudimentary, and I want
I am using Microsoft Visual Studio Professional 2010. (Also SQL Management Studio for my
Okay I'm a little confused on how to do this due to the fact
I came up with an interesting way to solve the following problem and I
I'm trying to figure out the right way to serve icon files for our

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.