Advertisement
hristo_bratanov

Untitled

Jul 1st, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var httpRequester = (function () {
  2.     function getJSON(url, success, error) {
  3.         $.ajax({
  4.             url: url,
  5.             type: "GET",
  6.             timeout: 5000,
  7.             contentType: "application/json",
  8.             success: success,
  9.             error: error
  10.         });
  11.     }
  12.  
  13.     function postJSON(url, data, success, error) {
  14.         $.ajax({
  15.             url: url,
  16.             type: "POST",
  17.             contentType: "application/json",
  18.             timeout: 5000,
  19.             data: JSON.stringify(data),
  20.             sucess: success,
  21.             error: error
  22.         })
  23.     }
  24.  
  25.     return {
  26.         getJSON: getJSON,
  27.         postJSON: postJSON
  28.     }
  29. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement