Copied to clipboard

Flag this post as spam?

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


  • Le Xuan Trung 10 posts 80 karma points
    Aug 06, 2015 @ 02:57
    Le Xuan Trung
    0

    Pass data from view to controller using Json

    I have a view(content), and i want pass data from this view to controller, i was used $.ajax but it not working.

    My controller.

    public class SignUpController : UmbracoApiController
    {   
        [HttpPost]
        public string  UpLoad(string name)
        {
            return "Hello" + name;
        }
    }
    

    My view

    $('#upload').click(function () {
                    $.ajax({
                        url: "umbraco/api/SignUp/UpLoad",
                        data: {
                            name: "Trung"
                        },
                        type: "Post",
                        datatype: "Json",
                        success: function () {
                            alert(data);
                        }
                    });
                });
    

    I hope everyone will be helping solve this. Thanks. My english not good :D

Please Sign in or register to post replies

Write your reply to:

Draft