当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript jQuery.getJSON函数代码示例

本文整理汇总了TypeScript中jQuery.getJSON函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getJSON函数的具体用法?TypeScript getJSON怎么用?TypeScript getJSON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getJSON函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: loadMovies

 loadMovies(): Array<Movie> {
   let movies: Array<Movie> = [];
   $.getJSON('/movies').then(data => {
     data.forEach(movie => movies.push(new Movie(movie.title, movie.year, movie.rating)));
   })
   return movies;
 }
开发者ID:Lemoncode,项目名称:TypescriptMochaWebpackDemo,代码行数:7,代码来源:MovieDataService.ts

示例2: loadNotes

function loadNotes(){
  $.getJSON('notes.json',function(data){
    data.notes.forEach(note =>{
        $('#notes').append(`<li class="${note.id}">${note.title}</li>`);
    })    
});  
}
开发者ID:hansschenker,项目名称:jspm-jquery,代码行数:7,代码来源:main.ts

示例3: get

export function get(period: Task.IPeriod, groupBy: Property) {
    const data = {
        begin: period.begin,
        end: period.end,
        group_by: propertyToRequestNames[groupBy],
    };

    return $.getJSON("/rest/v1/report/", data).then(parseReportJson);
}
开发者ID:YuriyGorvitovskiy,项目名称:Taskenize,代码行数:9,代码来源:report.ts

示例4: loadNote

function loadNote(title:string){
    var searchString = `http://localhost:3000/notes?q=${title}`;
    alert(searchString);
    
    $.getJSON(searchString, function (data) {
        $('#notes').append(`<li class="${data.note.id}">${data.note.title}</li>`)
    });
    
}
开发者ID:hansschenker,项目名称:jspm-jquery,代码行数:9,代码来源:main.ts

示例5: function

socket.on("receive", function(msg) {
    console.log(msg);
    if (msg.type == connect.MessageType.RESPONSE) {
        console.log("Respuesta para:", connect.MessageType[msg.content.type]);
        console.log("Codigo de respuesta:", connect.ResponseCode[msg.content.code]);
    }
    else if (msg.type == connect.MessageType.NEW_CHAT) {
        $.getJSON('../../tmp/room.json', (data) => {
            if (data.room.name == msg.content.room)
                $('#chat').append(`<li><b>${msg.content.user}: </b>${msg.content.message}</li>`);
        });
    }
});
开发者ID:edoren,项目名称:ChatClient,代码行数:13,代码来源:room_controller.ts

示例6:

    USERS_REFRESH: (store, action) => {
        var state = store.getState();
        $.getJSON(state.channelSubscribersUrl, results => {
            var channelUsers = {};
            var usersMap = {};
            results.forEach(user => usersMap[user.userId] = user);
            Object.keys(usersMap).forEach((userId) => {
                const user = usersMap[userId];
                user.channels.split(',').map(channel => {
                    var users = (channelUsers[channel] || (channelUsers[channel] = []));
                    users.push(user);
                });
            });

            store.dispatch({ type: 'USERS_SET', channelUsers, users: channelUsers[state.selectedChannel] });
        });
    },
开发者ID:ServiceStackApps,项目名称:ReactChat,代码行数:17,代码来源:reducers.ts

示例7: Promise

    const promise : Promise<Array<MemberEntity>> = new Promise((resolve, reject) => {

      $.getJSON('https://api.github.com/orgs/lemoncode/members', function(data) {
          // do something with data
          var members : Array<MemberEntity>;

          members = data.map((gitHubMember) => {
            var member : MemberEntity = new MemberEntity();

            member.id = gitHubMember.id;
            member.login = gitHubMember.login;
            member.avatar_url = gitHubMember.avatar_url;

            return member;
          });

          resolve(members);
      });
    });
开发者ID:Lemoncode,项目名称:dotnetmlg_react,代码行数:19,代码来源:memberAPI.ts

示例8: Get

  // =========================
  // Send dispatch command to increment in one the async calls counter
  // Execute the async call action
  // On Success, On Error --> Send dispatch comment to decrement
  // Return promise
  // =========================
  public Get(url : string)
  {
    var deferred = Q.defer<any>();
    this._dispatcher(httpCallStarted());

    // TODO: enhance this, better error handling
    $.getJSON(url, function(data) {
        this._dispatcher(httpCallCompleted());
        deferred.resolve(data);
    }.bind(this)
    ,function (err) {
       this._dispatcher(httpCallCompleted());
       deferred.reject(err);
    }.bind(this)
  );

    return deferred.promise;


  }
开发者ID:ardiadrianadri,项目名称:react-typescript-samples,代码行数:26,代码来源:http.ts

示例9: home

 home() {
     console.log("Service Called");
     $.getJSON(FacilityURL + BookAtHome.Rnd *1000)
     .done((data) => {
         console.log("Success");
         this.Items = new Models.Facilities(data.Facilities);
         localStorage.setItem("Facilities", JSON.stringify(data.Facilities));
         console.log("LocalStorage Updated");
     })
     .fail(() => {
         this.Items = new Models.Facilities(Data.Facilities);
         console.log("Failure");
     }).always(() => {
         var grid = new Views.GridView({
             collection: this.Items
         });
         this.Layout.detail.show(grid);
         console.log("Rendered");
     });
     
 }
开发者ID:saqibshakil,项目名称:saqibshakil.github.com,代码行数:21,代码来源:Router.ts


注:本文中的jQuery.getJSON函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。