Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. $.ajax({
  2. type: "POST",
  3. url: "http://localhost:54025/Api.asmx/Login",
  4. contentType: "application/json; charset=utf-8",
  5. dataType: "json",
  6. xhrFields: { withCredentials: true },
  7. crossDomain: true,
  8. data: "{ 'userName':'" + userName + "','password':'" + password + "' }",
  9. success: ReceivedLoginResponse,
  10. error: function (jqXHR, textStatus, errorThrown) {
  11. console.error("jqXHR: %s rntextStatus: %s rnerrorThrown:%s", jqXHR.responseText, textStatus, errorThrown);
  12. }
  13. });
  14.  
  15.  
  16.  
  17. var nowDate = new Date();
  18.  
  19. var currentStartDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), 1);
  20. var currentEndDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate());
  21.  
  22. $.ajax({
  23. type: "POST",
  24. url: "http://localhost:54025/Api.asmx/GetMeasurePointConsumption",
  25. contentType: "application/json; charset=utf-8",
  26. dataType: "json",
  27. xhrFields: { withCredentials: true },
  28. crossDomain: true,
  29. data: "{ 'measurePointId':" + measurePointId + ", 'startDate':'" + currentStartDate.toJSON() + "','endDate':'" + currentEndDate.toJSON() + "', 'dataType': 'Day' }",
  30. success: ReceivedMeasurePointConsumptionResponse,
  31. error: function (jqXHR, textStatus, errorThrown) {
  32. }
  33. });
  34.  
  35. syntax = "proto3";
  36. package api;
  37.  
  38. import "google/api/annotations.proto";
  39.  
  40. service Authentication {
  41. // This rpc is used to check a valid user from other applications.
  42. rpc Login(LoginRequest) returns (LoginResponse) {
  43. option (google.api.http) = {
  44. post : "/Api.asmx/Login"
  45. body : "*"
  46. };
  47. option (google.api.cors) = {
  48. enable: true
  49. };
  50. }
  51. }
  52.  
  53. message LoginRequest {
  54. string userName = 1;
  55. string password = 2;
  56. }
  57.  
  58. message LoginResponse {
  59. ???? cookie ???
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement