作者:恒如初见_193 | 来源:互联网 | 2023-05-18 07:15
IamnotquiteadeptinmaneuveringjQuery,anditcametoapointthatIneedtodebugaprogramth
I am not quite adept in maneuvering jQuery, and it came to a point that I need to debug a program that was passed down from me without a documentation.
我不太擅长操纵jQuery,而且我需要调试一个在没有文档的情况下传递给我的程序。
I have this var a, an object, that I really want to know the content of its collection. In my mind I need a function like foreach()
in PHP to iterate over this object variable. Upon researching I end up in using jQuery.each(). Now I can clearly iterate and see what was inside var a.
我有这个var a,一个对象,我真的想知道它的集合的内容。在我看来,我需要像PHP中的foreach()这样的函数迭代这个对象变量。经过研究,我最终使用了jQuery.each()。现在我可以清楚地迭代并查看var内部的内容。
However, it was kind of annoying to alert once every value on the var a. What I wanna know if it's possible to display all the contents in just one pop of alert box?
但是,对var a上的每个值进行一次警报有点烦人。我想知道是否可以在一个警报框中显示所有内容?
Here is my code:
这是我的代码:
$.each(a, function(index, value) {
alert(index + ': ' + value);
});
The var a contains infos such as:
var a包含以下信息:
creationdate: date_here
id: SWFUpload
modificationdate: date_here
type: .jpg
index: 0
name: uploaded_filename.jpg
size: size_in_bytes
BTW: The var a is called via file upload script.
BTW:var a通过文件上传脚本调用。
2 个解决方案