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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:05:57+00:00 2026-06-17T16:05:57+00:00

I have a form I am trying to send in a GetJSON call. When

  • 0

I have a form I am trying to send in a GetJSON call. When I get to the Controller the model that si tied to the view is a null vlaue. I have had issues before dealign with returning data when I woudl get an empy object but never a null value. Below is the code I am using to send the form

  var cqvdata = $("form").serialize();

  $.getJSON('@Url.Action("GetEmailByAdvanced", "CustomerEmails")', { cqv: cqvdata }, function (contacts) {
       var emails = "";
       $.each(contacts, function (index, contact) {
           $('#BCCText').tagit('createTag', contact.Email)
       });

       return false;
   });

Below is what I have on the controller side

 public JsonResult GetEmailByAdvanced(MassEmailViewModel cqv)
 {


 }    

Here is what I get for results if I turn my argument into a string

"EmailFromAddressID=1&ToAddresses=&CCAddresses=bclairmont%40harr.com&BCCAddresses=adunn%40harr.com&Subject=&Body="

Below is the MassEmailViewModelClass and all sub classes

public class MassEmailViewModel
{
    public MassEmailViewModel()
    {
        ComplexQuery = new CustomerQueryViewModel();
    }

    public int EmailFromAddressID { get; set; }

    public CustomerQueryViewModel ComplexQuery { get; set; }

    public string ToAddresses { get; set; }
    public string CCAddresses { get; set; }
    public string BCCAddresses { get; set; }
    public string Subject { get; set; }
    [AllowHtml]
    public string Body { get; set; }

}

 public class CustomerQueryViewModel
{
    public CustomerQueryViewModel()
    {
        Products = new List<CustomerProductQueryProduct>();
        Details = new List<CustomerQueryDetail>();
    }

    public Boolean IncludeOnAll { get; set; }
    public Boolean ExcludeOnAll { get; set; }

    public List<CustomerProductQueryProduct> Products { get; set; }
    public List<CustomerQueryDetail> Details { get; set; }
}

public class CustomerProductQueryProduct
{
    public CustomerProductQueryProduct()
    {
        ProductDetails = new List<CustomerProductQueryProductDetail>();
        ProductVersions = new List<ProductVersion>();
    }

    public ProductType ProductType { get; set; }
    public Boolean Exclude { get; set; }
    public Boolean Include { get; set; }
    public int VersiondID { get; set; }

    public List<CustomerProductQueryProductDetail> ProductDetails { get; set; }
    public List<ProductVersion> ProductVersions { get; set; }
}

public class CustomerProductQueryProductDetail
{
    public ProductTypeDetail ProductDetail { get; set; }
    public Boolean Exclude { get; set; }
    public Boolean Include { get; set; }
    public string Value { get; set; }
    public string Value2 { get; set; }
}

public class CustomerQueryDetail
{
    public string Description { get; set; }
    public string Type { get; set; }
    public Boolean Exclude { get; set; }
    public Boolean Include { get; set; }
    public string Value { get; set; }
    public string Value2 { get; set; }
}

The only thing not being returned is my ComplexQuery in the serialize because I am using a JQuery dialog so it takes those elements out of the form. I woudl think I woudl get a MassEmaikViewModel with all the vlaues but ComplexQuery and have a null for that but I just get a null as iff the argument never even got initialized.

Any ideas on what could be causing this?

One other thing and I don’t know if this will help give anyone any insight or not but I can post from the form and have the MassEmailViewModel as the argument in the post and it works fine filling out all the values except for ComplexQuery

  • 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-17T16:05:58+00:00Added an answer on June 17, 2026 at 4:05 pm

    I figured it out after a ton of trial and error. It seems like GetJSON can’t handle passing the data. What I did to correctly get information was to change to an AJAX get call. I will post the code below

     $.ajax({
                                url: '@Url.Action("GetEmailByAdvanced", "CustomerEmails")',
                                type: 'GET',
                                data: cqvdata,
                                success: function (data) {
                                    //called when successful
                                    var emails = "";
                                    $.each(contacts, function (index, contact) {
                                        $('#BCCText').tagit('createTag', contact.Email)
                                    });
    
                                    return false;
                                },
                                error: function (e) {
                                    //called when there is an error
                                    //console.log(e.message);
                                }
                            });
    

    I used the exact data I had in the GetJSON. In fact I commented out the GetJSON and just put this in below it and I got my model filled in on the controller side.

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

Sidebar

Related Questions

I have a form that im trying to get emailed on submit using PHPmailer.
I have a form that is trying to insert some data into an SQL
I have a form wizard that contains 3 forms. Basically, what I am trying
I have a form. I am trying to validate it through AJAX GET requests.
I have a php file that I am trying to send the output in
I have this form with a multi-selection blocks, I am trying to get the
i have this form and im trying to get the value from the text
I have a form with an ID of 'manage_campaigns'. I'm trying to call a
I have this form with a multi-selection blocks, I am trying to get the
i'm trying to send my form data to my ASP MVC controller but the

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.