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, visit the help center
                            
                        
                    
                
                已关闭8年。
            
        

我有一个问题,如何向存储标签(例如(DB))的数据库发出AJAX请求:


ID |标签名称
1 |的PHP
2 | MySQL的

等等


然后将结果填充到:availableTags: ["tag1", "tag2", "tag3"];

剧本 :

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


编辑:

我的问题恰恰是如何呈现结果并将任何标签名称放在单独的括号中,并且它们应该像这样用逗号分隔:["tag1","tag2" etc.]

最佳答案

制作一个文件,该文件可根据您的要求获得所需的回报。
按照jquery manual *中的说明进行AJAX请求
....
利润!


*码:

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

关于javascript - Ajax请求并填充,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5685253/

10-11 08:21