Javascript Code:
<script type="text/javascript">
function SaveCustomerInformation() {
var data = {
SpecialStatusId: AnaOzelDurumId.GetValue(),
ContactPersonId: AnaÄ°lgiliPersonelId.GetValue(),
};
if (data.CustomerNameTextBox1.trim() == "" || data.CustomerNameTextBox1 == undefined || data.CustomerNameTextBox1 == null) {
$("#showwarning222").html('<img src="/Image/warning.png" title="Please enter a Customer Name!">').show();
}
else {
LoadingPanel.Show();
$.ajax({
url: "/Home/GeneralCustomersGridView2",
type: "POST",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(data),
success: function (mydata) {
if (mydata.error6 == true) { // Error
LoadingPanel.Hide();
alert("Customer Name already exists");
$("#showwarning222").html('<img src="/Image/warning.png">').hide();
}
else { // Success
$("#CustomersDisplay").html(mydata);
LoadingPanel.Hide();
$("#showwarning222").html('<img src="/Image/warning.png">').hide();
}
},
error: function () {
LoadingPanel.Hide();
$("#showwarning222").html('<img src="/Image/warning.png">').hide();
}
});
return false;
}
}
</script>
My Controller:
public ActionResult GeneralCustomersGridView2(MyModel model)
{
var stringView = RenderRazorViewToString("CenterPartial", GetModels());
return Json(stringView, JsonRequestBehavior.AllowGet);
}
else
{
return Json(new { error6 = true, JsonRequestBehavior.AllowGet });
}
return null;
}
All of my code is functioning perfectly.
I simply need to open the result in a new tab.
How can I achieve this after submitting data to my controller?
Any assistance on this matter would be highly appreciated.
Thank you.