I am trying to pass model from view to controller using javascript. But it returns null values.
Here is my view Newcamp.chstml
<input type="submit" value="Preview" id="ClickMe" class="cssLoginButton blue"/>
<script type="text/javascript">
function OpenWindow(query, w, h, scroll) {
var l = (screen.width - w) / 2;
var t = (screen.height - h) / 2;
winprops = 'resizable=0, height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + 'w';
if (scroll) winprops += ',scrollbars=1';
var f = window.open(query, "_blank", winprops);
}
$(function () {
$('#ClickMe').click(function () {
OpenWindow('@Url.Action("NewCampEmail", "Camp",new{model = @Model})', 700, 700, true);
});
});
</script>
My controller action NewCampEmail
[HttpGet]
[OutputCache(Location = OutputCacheLocation.None)]
[Authorize]
public ActionResult NewCampEmail(Models.NewCamp model)
{
return ReturnModelWithEmailType(model,EmailType.NewCampEmail);
}
In model I get null values. Why I am getting null values? Is there any change in my code? My model is same in NewCamp.chstml i.e. Models.Newcamp