我试图添加document.getElementByID("#divname")
,但它还没有成功。我正在学习,并感谢堆栈溢出用户的帮助。
$(document).ready(function() {
promise = $.ajax({
type:"GET",
dataType:"text",
url:"sgi.csv",
cache:false
});
promise.done(function(data){
var dataArr = data.split("\n");
$.each(dataArr,function(){
if (this != "") {
var row = new String("");
valArr = this.split(",");
row += "<tr>"
$.each(valArr, function(){
row += "<td>" + this +"</td>"
});
row += "</tr>"
$('tbody').append(row);
}
});
});
// Run script if request fails
promise.fail(function() {
console.log('A failure ocurred');
});
});
答案 0 :(得分:0)
document.getElementById('divName').append(var)