$(document).ready(function(){
var availableTags = [
"ActionScript",
"AppleScript",
"Apple",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
alert(availableTags);
});
这里的值是通过硬编码传递的。但我想要一个通过数据库的availableTags这个值
dbProdMgmtEntities context= new dbProdMgmtEntities();
var getvalueofproduct = (from p in context.tblProducts
select new
{
p.Title
}).ToArray();
ViewBag.locations = getvalueofproduct;
这在我的 jquery 代码中获取数组值和这个值。