I want to get the JSON data from MVC Controller.
NOTE: I am calling Controller through XMLHTTPRequest.Send(data)
.
The Controller is returning the JSON data, but I don't know how to get that data if we are using XMLHTTPRequest.
I am not using Ajax calls due to some reasons. But is it possible to get it through an XMLHttpRequest or response? If so, kindly help me..
Example for the controller is below. From this, I want to get the FileName and FilePath.
public JsonResult SaveAttachments()
{
try
{
.......
}
}
return new Program1.WebClient.App_Start.BaseController.WrappedJsonResult
{
Data = new
{
isSuccess = true,
CusEvent = "close",
CusMsg = "Attachment file upload successful",
FileName = fileName,
FilePath = filePath
}
};
}
catch (Exception ex)
{
throw new Exception("File upload failed. ");
}
}