Mahesh Patil

Mahesh Patil

  • NA
  • 41
  • 10.5k

MVC Model binding in ajax responce method

Apr 10 2015 10:46 AM
Hello
 
I want to bind MVC  model  in ajax call responce  like
 
$.ajax({
async: false,
url: $('#ajaxURLclockoutDetails').val(),
type: 'GET',
cache: false,
data: {
newServiceCode: Selectedvalue,
'ConsumerServiceAndPeriod.ConsumerID': $('#DConsumerID').val()
},
success: function (result) {
1) $('#ConsumerServiceAndPeriod.TimesheetID').val(result.TimesheetID);
or
2) @Html.HiddenFor(m => m.TimesheetID, new { Value =@<%'$("#DConsumerID").val()'%> })
 or
3)@Html.Hidden("ConsumerServiceAndPeriod.TimesheetID", result.TimesheetID)
 
});
 
i have mention three possible ways for binding model but no any of them worked
so any one can help me about 
bind ConsumerServiceAndPeriod model in ajax responce method
 
Thanks in advance 
 

Answers (3)