Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 4 posts 74 karma points
    Apr 16, 2019 @ 11:28
    Martin
    0

    Using Surface Controller without refreshing the view

    Hi All,

    I'm in a situation where I MUST use surface controllers to handle forms data. And I would like to do this without a page refresh, in another words without returning a View.

    Is there a way to submit a form that is hooked to surface controller, handle the data and stay on the same page without a page reload ?

  • AbsolutelyN 18 posts 173 karma points
    Apr 16, 2019 @ 14:34
    AbsolutelyN
    0

    Hi Martin. Perhaps use ajax to call the surface controller and return json or pain text depending on what's needed. Just make sure the names of the form elements match the model.

    public class CustomSurfaceController : SurfaceController
     {
             public JsonResult CustomMethod(CustomModel model) {
                  return Json(someObject);
             }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft