2
Answers

Sending Json data to Model in MVC

raj kadam

raj kadam

9y
415
1
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)