$.getJSON("/StoragePoint/ReadStoragePoint/", { id: $("#StoragePoint_Id").val() }, function (data) {
$("textarea[id='StoragePoint_AdditionalDetails']").val(data.AdditionalDetails);
}).success(function () { alert("second success"); })
.error(function () { alert("error"); })
.complete(function () { alert("complete"); });
Or
$.ajax({
type: 'POST',
url: '/StoragePoint/ReadStoragePoint',
data: { 'id': $("#StoragePoint_Id").val() },
dataType: 'json',
success: function (jsonData) { alert("Yes"); },
error: function () { alert('Error'); }
});
[Authorise(PermissionIdentifier.ReadStoragePoint)]
[AcceptVerbs(HttpVerbs.Get)]
public JsonResult ReadStoragePoint(int id)
{
string additionalDetails = StoragePointRepository.ReadSingle(id).AdditionalDetails;
var result = new JsonResult()
{
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
Data = new
{
AdditionalDetails = additionalDetails
},
};
return result;
}
JSon method: