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

  • Home
  • SEARCH
  • 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 6773723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:42:06+00:00 2026-05-26T15:42:06+00:00

var post = { ID:1 }; var step = [1,2,3,4,5]; post.step = step; console.log(post)

  • 0
var post = { "ID":1 };

var step = [1,2,3,4,5];

post.step = step;

console.log(post)

$.ajax({
    url:'rss/test',
    type:'POST',
    data:post
})

–

 public JsonResult Test(int ID, IEnumerable<string> step)
 {
     return Json(true);
 }

I want to post it through JSON, how can I do this? When I tried to do this I found that this did not work. The step are not worked (or post)

update: after setting it to

var post  = {
"ID":1,
step:[{'Name':'first'},{'Name':'second'}]
}

$.post("/rss/test",post,function(){
});

public JsonResult Test(int ID, IEnumerable<string> step)
        {
            return Json(true);
        }

i feel it’s work but i got result

step
Count = 2
    [0]: null
    [1]: null

in immediate window.

so i hope i am go in right direction but both thing are null. now someone can help me to get them work.

thanks

  • 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-05-26T15:42:07+00:00Added an answer on May 26, 2026 at 3:42 pm

    The data types on the server don’t match the object’s your sending from your client. Try this.

    public class Post
    {
        public int ID { get; set; }
        public IEnumerable<string> Step { get; set; } 
    }
    

    Then in your controller

    [HttpPost]
    public JsonResult Test(Post post)
    {
    
    }
    

    You have to check it though, didn’t compile it.

    To post the data you have to set the dataType properly:

    $.ajax({
      url:'rss/test',
      type:'POST',
      dataType: "json",
      contentType: "application/json",
      data:post
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My flash code: var request=new URLRequest('http://localhost/test.php'); request.method = URLRequestMethod.POST; var data = new URLVariables();
i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from
[AcceptVerbs(HttpVerbs.Post)] public ActionResult Upload(Photo photo) { foreach (string file in Request.Files) { var path
I'm doing a jQuery AJAX post like this: var form = $(#formid); form.submit(function() {
A jQuery AJAX request .post()s data to page.php, which creates $res and var_dump()s it.
How can I improve this username/password checking? [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(FormCollection collection) { var
My project is structured as follows: DAL public IQueryable<Post> GetPosts() { var posts =
Hello I am working with an ajax post function, where I send data and
$.get($(this).attr('id'), function(data){ var qp_post = $(data).filter('title'); alert(qp_post); }); This fetches the content fine however
$.post(/diabetes/ropimages/getcount.php,{pid:$(#patient_id).val()} ,function(data1){ //alert(data1); var count = data1; var pid = $(#patient_id).val(); var rid; for(

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.