小编Igo*_*nko的帖子

将JSON数据从Sencha Touch发送到ASP.NET MVC

我正在尝试将数据发送到服务器.但我的代码不起作用.有人能指出错误吗?

Sencha代码:

Ext.Ajax.request({
                        url: '/Blog/SavePost',
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json;charset=utf-8'
                        },
                        params: {
                            id: currentPost.data.Id,
                            title: currentPost.data.Title,
                            text: currentPost.data.Text,
                            authorName: currentPost.data.AuthorName,
                            authorEmail: currentPost.data.AuthorEmail,
                            postDate: currentPost.data.PostDate
                        },
                        failure: function (response) { },
                        success: function (response, opts) { }
                    });
Run Code Online (Sandbox Code Playgroud)

MVC代码:

[HttpPost]
    public ActionResult SavePost(int id, string title, string text, string authorName, string authorEmail, DateTime postDate)
    {
        Post post = new Post { Id = id, Title = title, Text = text, AuthorEmail = authorEmail, AuthorName = authorName, PostDate = postDate …
Run Code Online (Sandbox Code Playgroud)

json sencha-touch asp.net-mvc-3

6
推荐指数
1
解决办法
7566
查看次数

标签 统计

asp.net-mvc-3 ×1

json ×1

sencha-touch ×1