Advertisement
Guest User

html

a guest
Nov 22nd, 2017
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var APP_ID = 'B6441196-0A34-10DE-FFA3-8C2D0EB63200';
  2. var API_KEY = '6D2829D5-54B0-F59D-FF38-137A2148C500';
  3.  
  4. Backendless.serverURL = 'https://api.backendless.com';
  5. Backendless.initApp(APP_ID, API_KEY);
  6.  
  7. loginUser();
  8.  
  9. function loginUser()
  10. {
  11.     //login to the system
  12.     Backendless.UserService.login("web@hi.bye","12345",true)
  13.     //what to do when logged in
  14.     .then (function(loggedInUser){
  15.         console.log("user was logged in");
  16.         writeData();
  17.     })
  18.     //what to do when we have an error
  19.     .catch(function(error){
  20.         console.log("Huston we have a problem");
  21.         console.log(error);
  22.     });
  23. }
  24.  
  25. function writeData()
  26. {
  27.     var myData = {
  28.         name: "Ivgani",
  29.         age: 34,
  30.         isMarried: true,
  31.         children: 3,
  32.         phone: "052-12345678",
  33.         location: "Haifa",
  34.         lastSalary: 81000.02
  35.     }
  36.    
  37.     Backendless.Data.of("Contact").save(myData)
  38.     //if we was able to write some data to our fucking data base
  39.     .then (function (savedObject){
  40.         console.log("data was saved.....");
  41.     })
  42.     //we have a fucking error
  43.     .catch(function (error)
  44.     {
  45.         console.log("we have a fucking error:");
  46.         console.log(error);
  47.     });
  48.    
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement