Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function GetData() {
  2. $.ajax({
  3. type: "POST",
  4. url: "/api/MyData",
  5. headers: headers,
  6. contentType: "application/json",
  7. data: JSON.stringify(params),
  8. success: function (result) {
  9. $("#result").html('');
  10. $("#result").html(result.somedata);
  11. },
  12. error: function (error) {
  13. if (error.statusText == "Unauthorized") {
  14. Refresh(); //Refresh access token
  15. GetData(); //Call this function again to get data while authenticated
  16. }
  17. }
  18. });
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement