简体   繁体   中英

How to display menu items from database using jquery and javascript

Hi i'm writing a menu list with css jquery and javascript : i want to get the menu items from a database

js code:

  var selectAllStatement = "SELECT * FROM Contacts";
           function  findAll(){
       var name;
     db.transaction(function(tx) {
    tx.executeSql(selectAllStatement, [], function(tx, result) {
    dataset = result.rows;
        for (var i = 0, item = null; i < dataset.length; i++) {
          item = dataset.item(i);
          name = item['firstName'] }
                   });
                                  });

              } 

html file:

    <section id="popupAccordeon" class="hide">

<div id="popup-bg">
</div>

     <div id="popup-box">   

    <ul class="niveau1">
        <li><a href="">  Players Name</a>
                <ul class="niveau2">

        <li><a href="http://www.rankspirit.com"> </a></li> // this are items i want to get them from table Contacts

            </ul>

  </section>

你必须使用一些服务器端语言,如PHP,C#,Java,Ruby等。这取决于你的服务器。

Javascript, CSS and HTML works on the frontend of the sites. These files are downloaded to the browser and they run in the browser's scope.

Database resides in the server. You would need a server side language for interacting with database and generating the necessary html to be sent to the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM