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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:05:07+00:00 2026-06-15T17:05:07+00:00

I am trying to create a jQuery .ajax program in which the user clicks

  • 0

I am trying to create a jQuery .ajax program in which the user clicks button in view, which triggers to $.ajax followed by send name to controller where controller add hello in front of name and send back json response.

I have managed to receive JSON response from controller, but failed to read post data name in controller.

Here is my code:

controller class

    public JsonResult processJsonRequest(PersonModel model)
    {       
        string returnString = "Hello , receive JSON data" + model.Name;
        return Json(returnString, JsonRequestBehavior.AllowGet);
    }

Model class

public class PersonModel
{
    public string Name { get; set; }
}

View

@{
ViewBag.Title = "Index";}

 @Scripts.Render("~/bundles/jquery")

 @using (Html.BeginForm())
   {
      <input type="button" id="b1" value ="Press Me" />  
   }

 <script type="text/javascript">

   $(document).ready(function () {

    $("#b1").click(function () {

        var person = { Name: 'khurram' };

        $.ajax({
            type: "POST",

            url: "/JSON_Ajax_03/processJsonRequest",
            data: JSON.stringify(person),
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            success: function (response) {
                alert(response);
            }
        });
    });
});

</script>
  • 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-15T17:05:09+00:00Added an answer on June 15, 2026 at 5:05 pm

    Instead of:

    JSON.stringify(person)
    

    Do this:

    JSON.stringify({ model: person });
    

    The problem is you aren’t naming the model parameter correctly.

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

Sidebar

Related Questions

I am trying to create a jQuery Gallery that lets the user flip (with
I'm trying to create a Hide/Show button with jQuery. When .cminus is clicked, it
I'm trying to create a feed using jquery ajax and requesting data from facebooks
I am trying to create a dynamic set of dropdown boxes, using jQuery/AJAX and
I am trying to create a jquery UI nested tab dynamically on a button
I am trying to create a jquery plugin to do ajax table pagination (i.e
I am trying to create a form that utilizes PHP and Jquery AJAX form
In my Rails app, I'm trying to use jQuery ajax to create a new
I'm trying to create an ajax 'quick view' or 'quick cart' type feature on
How it works: I'm trying to create an instant upload function with Jquery/Ajax. When

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.