Get data from a MVC JsonResult action method

With jQuery it's now very easy to execute a post to a Asp.Net MVC action method and receive a answer in Json

Example for sending a parameter to the jsonresult method ( domein ) and receiving a jsonresult with available domain-names

    function FillAvailableDomeinenList(domein) {
            $.getJSON("/Domein/GetAvailableDomeinNames?domain=" + domein, null, function (data) {
                ShowMessage("leeg", false);
        catch (ex) {

After that you can work with the data, in this case: fill a select list with options

    function FillSelect (data) {
        return $("#AvailableDomeinList").each(function() {
            if (this.tagName == 'SELECT') {
                var dropdownList = this;
                $.each(data, function(index, optionData) {
                    var option = new Option(optionData.Text, optionData.Value);
                    if ($.browser.msie) {
                    else {
                        dropdownList.add(option, null);




Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!