我正在使用VS2012,并运行ASP.NET MVC4项目。如何在jQuery中读取Json文件
我似乎无法得到这个低于火:
$.ajax({
url: "~/xml/JsonTest.json",
type: "GET",
dataType: "json",
success: function (json) {
alert("HI");
}
});
我也尝试过这种方式,但都无济于事:
$.getJSON('../xml/JsonTest.json', function (json) {
alert("GET JSON !");
});
难道不知何故没有找到的目录结构? 谢谢。 鲍勃
请检查是否这会有所帮助:http://iviewsource.com/codingtutorials/getting-started-with- javascript-object-notation-json-for-absolute-beginners/ – Roshit