Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loginUser() {
- var version = "";
- var sessionId = "Hello!";
- .
- . //some code here
- .
- jQuery.jsonRPC.request('getVersion', {
- params : {},
- success : function(result) {
- version = result.result[1];
- jQuery.ajax({
- url:"index.php?module=SDK&action=SDKAjax&file=marte/src/1100/GetLoginInformationAjax",
- dataType:"json",
- type: "post",
- data: "function=get_loginInfo",
- async: false,
- cache: false,
- success: function(res){
- user = res['user'];
- password = res['password'];
- try {
- jQuery.jsonRPC.request('login', {
- params : [ version, user, password ],
- success : function(result) {
- sessionId = JSON.parse(JSON.stringify(result)).result.sessionId;
- alert("Test 1 "+sessionId);
- },
- error : function(result) {
- alert(JSON.stringify(result));
- }
- });
- } catch (e) {
- console.log(JSON.stringify(e));
- }
- },
- error: function(){
- alert('Login error');
- }
- });
- },
- error : function(result) {
- console.log(JSON.stringify(result));
- }
- });
- alert(sessionId+" Test 2");
- return sessionId;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement