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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:58:15+00:00 2026-06-17T03:58:15+00:00

Currently using MVC3 and using jQuery $.post function to send the ajax request to

  • 0

Currently using MVC3 and using jQuery $.post function to send the ajax request to the controller action called “SearchInitiated”. I’m having a little bit of a head-scratcher here because I’m not sure exactly where my issues lies. I’m sure its something minor that I have overlooked.

When I call my Controller method from an AJAX call, I am passing a json object (stringified) to a controller action. See below:

Request Headers from Chrome

Accept:/ Content-Type:application/x-www-form-urlencoded;
charset=UTF-8 User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64)
AppleWebKit/537.17 (KHTML, like Gecko)

Chrome/24.0.1312.52 Safari/537.17

X-Requested-With:XMLHttpRequest

Form Dataview

connectorId:1

sessionId:97e2d8b2-be9e-4138-91ed-42ef9c6a2cd6

party:
{“Tag”:null,”PartyIdentifier”:”1″,”Address”:null,”Address2″:null,”BusinessName”:””,”CellPhoneNumber”:null,”CIF”:””,”City”:null,”Country”:null,”DateOfBirth”:null,”EMailAddress”:null,”EmploymentTitle”:null,”EmployerAddress”:null,”EmployerAddress2″:null,”EmployerCity”:null,”EmployerName”:null,”EmployerPhoneNumber”:null,”EmployerState”:null,”EmployerZip”:null,”Fax”:null,”Firstname”:”TEST”,”Lastname”:”USER”,”MailingAddress”:null,”MailingAddress2″:null,”MailingCity”:null,”MailingState”:null,”MailingZip”:null,”Middlename”:null,”PhoneNumber”:null,”State”:null,”TIN”:”1111111″,”WorkPhoneNumber”:null,”Zip”:null}

javascript

 var parties =    @(Html.Raw(Json.Encode(Model.SearchParties)));
      function SearchForCustomer(id)
      {

      var currentSelectedParty = GetPartyById(id)
      //SearchPost is a wrapper for $.ajax using default values for dataType and contentType
      SearchPost(URL, {
                'connectorId': '@Model.ConnectorId',
                'sessionId': '@Model.SessionId',            
                'party' :  JSON.stringify( currentSelectedParty ) 
            }
      }

Controller

 public ActionResult SearchInitiated(int connectorId, string sessionId, SearchParty party)
 {
     code here....
 }

 public class SearchParty
    {
        public SearchParty();
        public SearchParty(string lastname, string firstname);

        public string Address
        {
            get;
            set;
        }
           public string City
        {
            get;
            set;
        }
        public string Country
        {
            get;
            set;
        }
        public string DateOfBirth
        {
            get;
            set;
        }

        .... etc etc
}

However, the party object is null.

If I change the code to the following, everything deserializes correctly into the strongly typed object.

 public ActionResult SearchInitiated(int connectorId, string sessionId, string party)
 {
     JavaScriptSerializer json_serializer = new JavaScriptSerializer();
            SearchParty sp =
                   json_serializer.Deserialize<SearchParty>(party);
 }

I know my json string is valid since it is working in the second code snippet and the value is being passed in the call. What else could I be missing?

  • 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-17T03:58:16+00:00Added an answer on June 17, 2026 at 3:58 am

    I resolved my error by modifying the javascript ajax call to this:

     SearchPost(URL, JSON.stringify( {
                'connectorId': '@Model.ConnectorId',
                'sessionId': '@Model.SessionId',            
                'party' :   currentSelectedParty  
            }))
    

    I needed to stringify the entire data object sent in the ajax call, not just the ‘party’ object

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

Sidebar

Related Questions

I'm currently using ASP.NET MVC3 RC and I'm using the unobtrusive JQuery validations as
I have an MVC3 application doing AJAX edit of a grid line using JQUERY
im using MVC3. im trying to redirectToAction after doing a jquery post. edit: sorry
We're using jQuery.ajax() methods to request server data on a number of pages on
I'm currently working on my first MVC3 application at work (using the Razor view
I'm currently using ninject.mvc3 in my asp.net webapi project, and it works fine. I
I have a very simple .NET MVC3 project set up using jquery mobile for
We are currently building a mid-sized intranet application using MVC3. One requirement is the
I'm using MVC3 and currently i'm following a practice such that I declare one
I've used a jQuery ajax post on a form generated from a MSAjax MVC

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.