I like to call an MVC action by passing parameters as a Model and I want to show the return view in a new Window.
I tried in two different ways as below from Javascript but it is not working:
1.
window.open(
'@Url.Action("EIDLookUp", "LookUp")?details=' + JSON.stringify(labInputLDAPInput),
'',
width=1024,
height=665,
titlebar=1,
toolbar=No,
menubar=No,
scrollbars=Yes,
resizable=Yes,
location=No,
directories=No,
status=Yes'
);
2.
$.ajax({
url: '@Url.Action("EIDLookUp", "LookUp")',
data: labInputLDAPInput,
type: 'POST',
dataType: 'html',
success: function (response) {
var w = window.open();
$(w.document.body).html(response.responseText);
}
})
My Controller action looks like this:
[HttpPost]
public ActionResult EIDLookUp(LookUpDetails details)
{
GetDataFromLDAP empData = new GetDataFromLDAP();
IEnumerable<SearchClientResult> employeeList =
empData.GetEIDLookUpData(details.eidLookUp, details.activeOnly);
// Assign values to View Model
//LookUpDetails details = new LookUpDetails();
details.employeeList = employeeList;
//details.found = found;
//details.fieldID = fieldID;
//details.multiple = multiple;
//details.activeOnly = activeOnly;
details.row = 1;
return View("EIDLookUp", details);
}
Please let me know how to make this work. Thanks in advance.