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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:10:40+00:00 2026-05-24T20:10:40+00:00

I want to parse 2 strings (Just testing with one atm( consiting of a

  • 0

I want to parse 2 strings (Just testing with one atm( consiting of a date from a datepicker and hour and minute from 2 textfields. But I cant figure out how to parse data from my ajax call to the method I call, I know its called as I checked with a breakpoint, but its parameter is just null.

My ajax:

$('.datein').change(function () {
    alert("datein changed");
    //send servervalidering ajax
    var result = false;
    $.ajax({ url: "Resource/isDateValid/",
            data: ($('#resource_datein').val() + "-" + $('#resource_hourin').val() + "-" + $('#resource_minutein').val()),
        type: "POST",
        sucess: ajaxsuccess(result)
    }
    );
});

My methodcall on success

function ajaxsuccess(result) {
    alert("ajax lykkes!" + result);
}

And the controller method which is part of public class ResourceController : DataTablesController

    [HttpPost]
    public bool isDateValid(string dateIn)
    {

        return true;
    }

string dateIn just returns null if I set a date

  • 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-24T20:10:41+00:00Added an answer on May 24, 2026 at 8:10 pm

    try something like

    //js
    
    var data = $("myform").serialize(); //Might be serializeArray() not on dev machine sorry
    
    $.post("Resource/isDateValid/", data, function(data){
       alert(data.Success);
    }, "json");
    

    Controller (assuming Resource is a class because of the underscore in the ids…)

    [HttpPost]
    public JsonResult(Resource resource) //or (DateTime resource_datein, int resource_hourin)
    {
        bool success = true;
    
        //Do something with posted data
    
        return Json(new { Success = success});
    }
    

    EDIT (re comment)

    take the () off the AjaxSuccess function call in the $.post

    $('.datein').change(function () {
                //send servervalidering ajax
                var data = $(".datein").serialize();
                $.post("Resource/isDateValid", data, ajaxsuccess, "text");
            });
    

    with

    function ajaxsuccess(data)
    {
       alert(data.Success); // in your case alert(data); because it's "text"?
    }
    

    also because you are not serializing the entire form your data should be:

    var data = {dateIn : $(".datein").val()};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have strings with dates, and want to parse these into NSDate objects. Is
I want to parse the input string and extract the values from it. My
I have a date string and I want to parse it to normal date
I've made a little forum and I want parse the date on newest posts
Just started with JavaCC. But I have a strange behaviour with it. I want
I want to use joda to parse datetime strings in emails. Unfortunately I get
I work in VBA, and want to parse a string eg <PointN xsi:type='typens:PointN' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
I want to parse a filter string similar to the following: ((Field1 = 'red')
I'm want to parse a custom string format that is persisting an object graphs
I want to parse a config file sorta thing, like so: [KEY:Value] [SUBKEY:SubValue] Now

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.