How do I parse variables from ajax to a controller and return a bool

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

newest questions tagged jquery – Stack Overflow

About Admin