天天看點

MVC的ajax向controller,asp.net mvc - AJAX call to MVC controller action - Stack Overflow

I am new to MVC programming.I am working on a simple POC application that displays/edits data from Database.

I have 2 views and 2 controllers. On one of them the JQuery AJAX call to MVC controller action method is working fine. But not on the other one (In here, the AJAX call is not triggering the Action method).

Can anyone had this situation before???

The JQuery code is below:

$('#ddlZones').change(function () {

var value = $('#ddlZones option:selected').val();

// alert(value); var status = $('#ddlStatus option:selected').val();

// alert(status); $('#lstResources').children().remove();

$('#lstBeds').children().remove();

$.ajax({ url: 'FillResources', type: 'POST',

data: JSON.stringify({ ZoneId: value }),

dataType: 'json', contentType: 'application/json',

success: function (result) {

for (var r in result) {

$('#lstResources').append('' + result[r].Text + '');

}

}

});

});

Thanks

Latha