Ajax请求并填充[关闭]

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2011-04-18 02:14:49Z" class="relativetime">9 years ago</span>.</div>
        </div>
    </aside>

I've a question how can I do an AJAX request to a DB, in which I store tags, for example (DB):

  • ID | tag_name
  • 1 | php
  • 2 | mysql

    etc.

and then to populate this results into : availableTags: ["tag1", "tag2", "tag3"];

the script :

$(document).ready(function(){
    $("#mytags").addtags({
        availableTags: ["tag1", "tag2", "tag3"]
    });
});

EDIT:

My question is exactly how to render the results and put any of the tags names into separate brackets and they should be coma separated like this : ["tag1","tag2" etc.]

</div>
  1. Make a file that gets you the needed return on request.
  2. Do an AJAX request as described in the jquery manual*
  3. ....
  4. profit!

*code:

$.ajax({
  url: "yourURL.php",
  context: document.body,
  success: function(){
    //DO YOUR STUFF HERE. Probably something with the tags and all
  }
});