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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:29:12+00:00 2026-06-17T23:29:12+00:00

im really new to MVC and modelbinding so i guess im making something trival

  • 0

im really new to MVC and modelbinding so i guess im making something trival wrong, i try to bind some data;

View;

    $.ajax({
            url: '@Url.Action("Moo")',
            type: "post",
            dataType: "string",
            contentType: "application/json",
            data: JSON.stringify({"test": "bar", "test2": "bar2"}),
            success: function (data) {}       
    });

Model;

Public Class MyTestData

     Public Property test() As String
     Public Property test2() As String

End Class

Controller;

Function Moo(test As MyTestData) As ActionResult

    Return View()
End Function

When i run the dubugger i recive “nothing” from test in the controller, if i try with only one string the code works (the data in the view changed to {(test:bar)} and the controller datatype changed to from MytestData to String).

Any input is appriciated.

  • 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-17T23:29:14+00:00Added an answer on June 17, 2026 at 11:29 pm

    Rename your action parameter. It’s called test and conflicting with the test property that you have inside:

    Function Moo(model As MyTestData) As ActionResult
        Return View()
    End Function
    

    I guess you got too many tests 🙂 FooBar seems like a better name 🙂

    Joke aside you also have a problem with the dataType parameter. There’s no such value as string. With ASP.NET MVC you usually do not need to supply it because the framework properly sets the HTTP Content-Type response header and jQuery will use it in order to parse the result automatically. So simply get rid of it, or make sure you have specified it to a correct value to match your actual return type. Since your action returns a view you could set it to dataType: 'html' in order to be consistent.

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

Sidebar

Related Questions

I'm really new to ASP.NET MVC, and I'm trying to integrate some Javascript into
First of all, I'm really new to the MVC Asp.Net ideology. I would like
I'm really new to Spring and Spring MVC and I'm working on a kind
Okay, so I'm fairly new to model binding in MVC, really, and my question
I have a problem with TinyMVC. I'm really new with this MVC framework. I
Im really new to Grails and I try to understand how it works. I
I am really really really new to ASP MVC and I want to add
I'm pretty new to mvc and jQuery... and to web development in general really.
Im fairly new to ASP.NET MVC 3, and to coding in general really. I
Hi i'm new to MVC and EF so this may be a really simple

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.