可见绑定不起作用(淘汰js)

时间:2016-03-17 12:35:17

标签: jquery knockout.js

net MVC usig knockout js绑定数据。 但我坚持以下问题。 如果ajax结果返回true但是它不起作用,我显示消息 以下是代码。请帮帮我



 self.Message = ko.observable(false);      

          $.ajax({
                url: '@Url.Action("SaveAccount", "Accounts")',
                cache: false,
                type: 'POST',
                contentType: 'application/json',
                data: jsonData,
                success: function (result) {
                    //ShowToastMessage("This is message", "This is title");
                    self.DealerID(result.DealerId);
                    self.Message = ko.observable(result.Message); //result.Message = true   
                    //self.Message(result.Message);
                    //window.location.href = result.url;
                },
                error: function (errorThrown) {
                }
            });

<div class="alert alert-success alert-dismissable" id="Success-alert" data-bind="visible: Message">
   <label>Success! Account has been saved successfully</label>
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案