Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AJAX发布到knockout.js的数据绑定不起作用_Javascript_Jquery_Ajax_Knockout.js - Fatal编程技术网

Javascript AJAX发布到knockout.js的数据绑定不起作用

Javascript AJAX发布到knockout.js的数据绑定不起作用,javascript,jquery,ajax,knockout.js,Javascript,Jquery,Ajax,Knockout.js,我正在尝试使用AJAX帖子从web服务中提取列表。。。它没有返回任何数据。。。下面是我对AJAX和AJAX函数的调用:我知道它会返回数据,因为我在代码隐藏中的回发中使用了它。有什么建议吗 ko.applyBindings(new theatreSel.TheatreModel()); Regal.showLocationModal(); return false; // declare viewmodel constructo

我正在尝试使用AJAX帖子从web服务中提取列表。。。它没有返回任何数据。。。下面是我对AJAX和AJAX函数的调用:我知道它会返回数据,因为我在代码隐藏中的回发中使用了它。有什么建议吗

ko.applyBindings(new theatreSel.TheatreModel());
               Regal.showLocationModal();
               return false;



  // declare viewmodel constructors in standard fashion
    function TheatreModel() {
        var self = this;

        self.theatreData = ko.observableArray();

        $.ajax('/Services/TheatreLocationList.asmx/getTheatres',
                       {
                           data: {},
                           type: 'POST',
                           contentType: 'application/json; charset=utf-8',
                           dataType: 'json'

                       }).success(function(data){
                           self.theatreData = (data.d);
                           alert("success!");
                       });                            


    }
和web服务:

   public class TheatreLocationList : System.Web.Services.WebService
    {
       // public IEnumerable<dynamic> TheatreList { get; set; }

        [WebMethod]        
        public List<dynamic> getTheatres()
        {
            List<dynamic> TheatreList = new List<dynamic>();
            int radius = Regal.Core.Helpers.ConfigHelper.GetIntValue("SearchRadius", 30);
            IFrdiTheatreRepository frdiTheatreRepo = FrdiTheatreRepository.CreateBusinessObject();
            TheatreCollection theatreCollection = frdiTheatreRepo.GetAllTheatresFromRegalByPostalCode("60613", radius);
            TheatreList = (theatreCollection.ToList<dynamic>());
            return (TheatreList);


        } 
    }
公共类剧院定位列表:System.Web.Services.WebService
{
//公共IEnumerable剧院列表{get;set;}
[网络方法]
公共列表getTheatres()
{
列表剧院列表=新列表();
intradius=Regal.Core.Helpers.ConfigHelper.GetIntValue(“SearchRadius”,30);
IfrDitHeaterRepository frditHeaterRepository=frditHeaterRepository.CreateBusinessObject();
剧院集合剧院集合=FRDITHEATERREPO。从RegalByPostalCode(“60613”,半径)获取所有剧院;
剧院列表=(剧院集合.ToList());
返回(戏剧演员);
} 
}
试着这样做:

.success(function(data){
    self.theatreData(data.d);
    alert("success!");
});