當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。