Is there a way I can add extra data to my Ajax ActionResult in MVC?
I want my controller to create a new PartialView and then add extra data to it which can then be picked up in the Ajax OnSuccess function.
I have tried passing back a Json result from the controller with my custom data in it and using that in the OnSuccess function, but then, because I was only passing back my custom data and no HTML, the Ajax UpdateTarget div now goes blank because Ajax fills the div with my Json result which is not HTML.
I would like a way for my controller to send back a PartialView so my UpdateTarget div gets updated, that also contains my own custom data which I can use in the OnSuccess function.
Any help would be appreciated.
Thanks
Mike
You can use the following method in your controller:
I put this method into basic controller:
Call this action from your view using manual ajax call, for example: