1

I am creating a data storage site with html, css, and javascript. On the login, It uses an if/else inside of a function. An example of what I need is below:

$('.activelogin').click(function(){
//get the username
//get the password
if (username === 'myName') {
document.cookie = 'succesful=true';
//go to more code
} else {
document.cookie = 'successful=false';
}
//more code

How do I get to //more code from //go to more code?

  • 2
    If you replace "teleport" with "function", you're golden. – adeneo May 19 '16 at 14:52
  • I mean there is no "teleport", but there are functions, that can be called where you choose etc. – adeneo May 19 '16 at 14:58
  • `I am creating a database with html, css, and javascript. ` makes no sense in my mind...what are you trying to achieve? – messerbill May 19 '16 at 14:59
  • I am creating a way to store date and allow me and my friends to send and recieve on it too, and well as storing permanent info on it. –  May 19 '16 at 15:00
  • You can't do that with cookies? Anyway, learn how functions work first -> https://jsfiddle.net/0yjhj9h1/ – adeneo May 19 '16 at 15:01
  • @adeneo is correct...write a function and call it in your code. For example: `function myLogin() { //function code }` and then call it with: `myLogin();` – johnniebenson May 19 '16 at 15:02
  • Two words: function variables. –  May 19 '16 at 15:03

0 Answers0