1

Good Evening,

I want to create an autocomplete script for my PM system so the user never type the username wrong!!! i have something like this:

<script>
  $(function() {
    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  });
  </script>

But is it possible to echo all the usernames from the database inside the JQuery script???

It would be great and helpfull!

1 Answer 1

1

Yes it is possible. You create a .phtml file and you loop all of them in your <script> tags or echo json_encode. It's up to you.

But don't think that can't be over passed. People can simply delete your js and send whatever they want to the server. You need to have the appropriate checks in your backend as well.

Sign up to request clarification or add additional context in comments.

3 Comments

damn, there are some new words for me hahah, i'm a application developer in training, first year at school. but thanks for your response!!!
good luck with that. You should also look up PDO for database connection if you are going to use php.
thanks, i will let my mentor know, so we can look into PDO!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.