English 中文(简体)
无效网络服务电话、落后参数的缺失值和网络服务
原标题:Invalid web service call, missing value for parameter with Backbone and Webservice webmethods

能否使主干能够与用于挽救和检索数据的英勇网络服务方法接口? 由于从网上方法中得出这一错误,实际上POST包含这些参数。

Server Side

[WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static Dummy SaveDummy(Dummy myDummy)
        {
            Dummy dumdum = myDummy;
            HttpContext.Current.Session["data"] = dumdum;
            return myDummy;
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
        public static Dummy FetchDummy()
        {
            return (Dummy)HttpContext.Current.Session["data"];
        }

        public class Dummy
        {
            private string _name;
            private string _script;

            public string Name
            {
                get { return _name; }
                set { _name = value; }
            }

            public string Script
            {
                get
                {
                    return _script;
                }
                set { _script = value; }
            }
        }

Backbone Model

  window["model"] = Backbone.Model.extend({
        initialize: function () {
            console.log("CREATED");
        },
        defaults:{
            name:"Please enter your name",
            script:"Hello World"
        },
        urlRoot: "index.aspx/SaveDummy",
        validate: function (attrs) {

        }
    });

Application

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

    var myModel = new model({
        name: "Stack Overflow",
        script: "alert( Hi SO )"
    });

    var myView = new view({
        model: myModel,
        el: $("#placeholder")
    });

    console.log("SAVING");
    myModel.save();

    console.log("FETCHING");
    myModel.fetch();

POST

{“名称”:“Stack Overflow”,”script: “alert ( Hi SO )”}

Message

Invalid web service call, missing value for parameter: myDummy .

Note

I did look into other posts with similar problem, which were solved by doing something like {myDummy={"name":"Stack Overflow","script":"alert( Hi SO )"}} . How could this be generated using Backbone?

最佳回答

后台的所有服务器与机方同步通过后台处理。 2. 协同:

  • REST apis that work with JSON (not SOAP/XML)
  • Extensibility

因此,你必须推翻后台。 与你的支持者交谈的协同行为。 这似乎相对简单。 在这些联系中可以找到一些指导:

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签