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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:29:36+00:00 2026-05-11T08:29:36+00:00

Guys, I can’t seem to get the object serialization working correctly clientside for my

  • 0

Guys, I can’t seem to get the object serialization working correctly clientside for my app? When I used the getJSON() method inside jQuery with a response mime type of text/json (serialized using JSON.Net library), it was working fine, but as soon as I moved it across to an ajax() request (so I could post my code in webmethods on my page) its fallen apart. Any ideas would be greatly appreciated.

Edit: I’m using framework 2.0, not 3.5

My javascript looks like this:

    function companySearch(txt)      {         $('#<%= divCompanyResult.ClientID %>').hide();         $('#<%= divCompanyResult.ClientID %>').html('');          var strCompanySearch = $('#<%= tbCompanySearch.ClientID %>').val();          $.ajax         ({             type: 'POST',             url: 'Home.aspx/GetCompanies',              contentType: 'application/json; charset=utf-8',              datatype: 'json',             data: '{name: '' + strCompanySearch + ''} ',              success: companySearchSuccess,             error: onError         });          return (true);     }      function companySearchSuccess(response)     {         $.each(response,              function(i, company)              {                 $('#<%= divCompanyResult.ClientID %>').prepend(company.Name + '<br />');             });          $('#<%= divCompanyResult.ClientID %>').slideDown(1000);     } 

And my .ASPX page (nb. its a page, not a webservice), looks like this:

    [WebMethod]     public static Company[] GetCompanies(string name)     {         Company[] companies = Company.FindCompanies(name);          return companies;     } 

And the object its returning:

[ActiveRecord] public class Company : ActiveRecordBase<Company> {     private int iD;     private string name;     private string accountNo;     private string streetAddr1;     private string streetAddr2;     private string streetSuburb;     private string streetCity;     private string postAddr1;     private string postAddr2;     private string postSuburb;     private string postState;     private string postPC;     private string accountType;     private string accountSubType;     private string areaRep;     private string status;     private string overview;     private string bpcsId;     private string modifiedBy;     private DateTime modifiedDate;     private IList<Contact> contacts;      [PrimaryKey]     public int ID { get { return this.iD; } set { this.iD = value; } }     [Property]     public string Name { get { return this.name; } set { this.name = value; } }     [Property]     public string AccountNo { get { return this.accountNo; } set { this.accountNo = value; } }     [Property]     public string StreetAddr1 { get { return this.streetAddr1; } set { this.streetAddr1 = value; } }     [Property]     public string StreetAddr2 { get { return this.streetAddr2; } set { this.streetAddr2 = value; } }     [Property]     public string StreetSuburb { get { return this.streetSuburb; } set { this.streetSuburb = value; } }     [Property]     public string StreetState { get { return this.streetCity; } set { this.streetCity = value; } }     [Property]     public string StreetPC { get { return this.streetCity; } set { this.streetCity = value; } }     [Property]     public string PostAddr1 { get { return this.postAddr1; } set { this.postAddr1 = value; } }     [Property]     public string PostAddr2 { get { return this.postAddr2; } set { this.postAddr2 = value; } }     [Property]     public string PostSuburb { get { return this.postSuburb; } set { this.postSuburb = value; } }     [Property]     public string PostState { get { return this.postState; } set { this.postState = value; } }     [Property]     public string PostPC { get { return this.postPC; } set { this.postPC = value; } }     [Property]     public string AccountType { get { return this.accountType; } set { this.accountType = value; } }     [Property]     public string AccountSubType { get { return this.accountSubType; } set { this.accountSubType = value; } }     [Property]     public string AreaRep { get { return this.areaRep; } set { this.areaRep = value; } }     [Property]     public string Status { get { return this.status; } set { this.status = value; } }     [Property]     public string Overview { get { return this.overview; } set { this.overview = value; } }     [Property]     public string BPCSId { get { return this.bpcsId; } set { this.bpcsId = value; } }     [Property]     public string ModifiedBy { get { return this.modifiedBy; } set { this.modifiedBy = value; } }     [Property]     public DateTime ModifiedDate { get { return this.modifiedDate; } set { this.modifiedDate = value; } }      // Inverse ensures is read-only ie. Contact controls the relationship     // Castle will usually infer relationship, but we explicitly set just to be on the safe side     [HasMany(Inverse=true, Table='Contact', ColumnKey='CompanyId')]      [ScriptIgnore]     public IList<Contact> Contacts { get { return this.contacts; } set { this.contacts = value; } }      protected Company() { }      public Company(string Name, string StreetAddr1)     {         this.Name = Name;         this.StreetAddr1 = StreetAddr1;          ModifiedBy = 'Test';         ModifiedDate = DateTime.Now;     }      public static Company[] FindCompanies(string name)     {         return FindAll(Expression.InsensitiveLike('Name', '%' + name + '%'));     }  } 
  • 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. 2026-05-11T08:29:37+00:00Added an answer on May 11, 2026 at 8:29 am

    Turns out I had overlooked the camel casing for the dataType property on my ajax request

    Old:

        $.ajax     ({         type: 'POST',         url: 'Home.aspx/GetCompanies',          contentType: 'application/json; charset=utf-8',          datatype: 'json',         data: '{name: '' + strCompanySearch + ''} ',          success: companySearchSuccess,         error: onError     }); 

    Solution

        $.ajax     ({         type: 'POST',         url: 'Home.aspx/GetCompanies',          contentType: 'application/json; charset=utf-8',          dataType: 'json',         data: '{name: '' + strCompanySearch + ''} ',          success: companySearchSuccess,         error: onError     }); 

    Hope this helps others avoid the hours of searching google, tutorials and blogs that I suffered… Doh!

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

Sidebar

Ask A Question

Stats

  • Questions 82k
  • Answers 82k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer without seeing the html I would say check your path.… May 11, 2026 at 4:40 pm
  • Editorial Team
    Editorial Team added an answer I would think you could just replace your the table… May 11, 2026 at 4:40 pm
  • Editorial Team
    Editorial Team added an answer Wow, I was royally screwing up. Of course ModelMultipleChoiceField doesn't… May 11, 2026 at 4:40 pm

Related Questions

Guys, I can't seem to get the object serialization working correctly clientside for my
Do you guys know how I can use the Curl command line to POST
Ok guys I thought I'd take my old CS notes and look through compiler
Hey guys, I'm researching something for a friend of mine who's involved in road
Hey guys, I have a problem. I have situation where domain in m_domainTable starts

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.