I want to get the value in my controller from ajax. I set a break point in the controller and it breaks, but the value is not there. Am I missing something in my code or do I need to change something?
Here is my controller code:
[HttpPost]
public ActionResult SubmitResponse(string responseData)
{
string test = responseData;
return View();
}
here is my ajax code:
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 500,
width: 900,
modal: true,
buttons: {
"Submit": function () {
var response = $.trim($('#name').val());
//responseData = JSON.stringify(responseData);
alert('response data = ' + response + '!!!');
//alert('YES');
$.ajax({
url: 'Questions/SubmitResponse',
type: 'POST',
data: JSON.stringify(response),
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function(){
alert('success');
},
error: function(){
alert('error buddy');
}
});
},