【发布时间】:2015-08-02 14:27:22
【问题描述】:
我在下面给出了数组作为我的 ajax 响应,现在我想将这些数组值附加到我的 html div 中,因为我已经使用了 for 循环但是出了什么问题?我得到低于输出(见附图)
//Array from php page
Array (
[FirstName] => Please enter your first name
[LastName] => Please enter last name
[Email] => This e-mail address is already associated to another account.
[ConfirmPassword] => Passwords do not match
)
//jquery
success:function(result){
for (var i = 0; i < result.length; i++)
{
console.log(result[i]);
$("#error_div").append(result[i]);
}
}
//want this output to append in div
Please enter your first name
Please enter last name
This e-mail address is already associated to another account.
Passwords do not match
【问题讨论】:
标签: javascript php jquery arrays ajax