Advertisement
TwiNNeR

Untitled

Sep 29th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadPostsSearch(searchString) {
  2.     $.ajax({
  3.         type: 'GET',
  4.         data: { searchQuery: '"' + searchString + '"', amount: 5, offset: offset, onlyPostCount: false },
  5.         contentType: "application/json; charset=utf-8",
  6.         dataType: "json",
  7.         url: 'http://kekxd.azurewebsites.net/KekService.asmx/getPostsBySearchJSON',
  8.         success: function (response) {
  9.             offset += 5;
  10.             var responseObj = JSON.parse(response.d);
  11.             addPosts(responseObj);
  12.             if (offset > postnum && postnum > 0) {
  13.                 $("#loadMore").hide();
  14.             }
  15.         },
  16.         error: function (a) {
  17.             console.log(a.responseText);
  18.         }
  19.     });
  20. }
  21.  
  22. function loadPosts() {
  23.     $.ajax({
  24.         type: 'GET',
  25.         data: { amount: 5, offset: offset },
  26.         contentType: "application/json; charset=utf-8",
  27.         dataType: "json",
  28.         url: 'http://kekxd.azurewebsites.net/KekService.asmx/getPostsByDateJSON',
  29.         success: function (response) {
  30.             offset += 5;
  31.             var responseObj = JSON.parse(response.d);
  32.             addPosts(responseObj);
  33.             if (offset > postnum && postnum > 0) {
  34.                 $("#loadMore").hide();
  35.             }
  36.         },
  37.         error: function (a) {
  38.             console.log(a.responseText);
  39.         }
  40.     });
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement