How to send js variables to mvc controller

前端 未结 2 1610
故里飘歌
故里飘歌 2020-12-09 06:54

I`m new to client-server programming concepts. What I need, to send four js vars to my MVC 3 controller action.

    $(document).ready(function() {
        va         


        
2条回答
  •  醉酒成梦
    2020-12-09 07:37

    Here goes solution -

    Model -

    public class ImageCoordinates
    {
        public int x1 { get; set; }
        public int x2 { get; set; }
        public int y1 { get; set; }
        public int y2 { get; set; }
    }
    

    Action -

        public ActionResult CreateCover(ImageCoordinates coordinates)
        {
            return null;
        }
    

    Lets create a View which will make the AJAX call to the Action.

    
    
    
    
    
    

    Output -

    enter image description here

提交回复
热议问题