2
Reply

Sending Json data to Model in MVC

raj kadam

raj kadam

Oct 29 2015 8:27 AM
397
this is my json code for sending value but it not getting at controller end..
$("#submitt").click(function ()
{
var name = $("#txtName").val();
var city = $("#txtCity").val();
var data = { 'name': name, 'city': city };
var obj = JSON.stringify(data);
$.ajax(
{
url: '/Mate/Create',
type: 'POST',
dataType: 'json',
data: {},
contentType: 'application/json; charset=utf-8',
success: function (obj)
{
alert(obj.d);
$("#content").html("Sending..");
}
})
});

Answers (2)