Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. function loginUser() {
  2.  
  3. var version = "";
  4. var sessionId = "Hello!";
  5.  
  6. .
  7. . //some code here
  8. .
  9.  
  10. jQuery.jsonRPC.request('getVersion', {
  11. params : {},
  12. success : function(result) {
  13. version = result.result[1];
  14. jQuery.ajax({
  15. url:"index.php?module=SDK&action=SDKAjax&file=marte/src/1100/GetLoginInformationAjax",
  16. dataType:"json",
  17. type: "post",
  18. data: "function=get_loginInfo",
  19. async: false,
  20. cache: false,
  21. success: function(res){
  22. user = res['user'];
  23. password = res['password'];
  24. try {
  25. jQuery.jsonRPC.request('login', {
  26. params : [ version, user, password ],
  27. success : function(result) {
  28. sessionId = JSON.parse(JSON.stringify(result)).result.sessionId;
  29. alert("Test 1 "+sessionId);
  30. },
  31. error : function(result) {
  32. alert(JSON.stringify(result));
  33. }
  34. });
  35. } catch (e) {
  36. console.log(JSON.stringify(e));
  37. }
  38. },
  39. error: function(){
  40. alert('Login error');
  41. }
  42. });
  43. },
  44. error : function(result) {
  45. console.log(JSON.stringify(result));
  46. }
  47. });
  48.  
  49. alert(sessionId+" Test 2");
  50. return sessionId;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement