Javascript:通过post发送数组
我正在制作一个网站,将无限数量的物理地址链接到一个帐户。添加地址时,脚本会检查字段并将每个字段的内容放入相应的数组中。它还计算发生这种情况的次数,以便更轻松地循环遍历服务器上的数组并为数据库创建插入语句。有没有办法通过 post 将这些数组发送回服务器,如果可以,如何使 PHP 可以读取它们?
编辑:Rafe Kettler 下面的评论很有帮助。这正是我所需要的,并且使我的工作变得更加轻松。感谢您的帮助。我选择的“答案”反映了我需要执行的编码类型,并向我展示了 1)这是可能的,2)它并不那么困难。
I am making a site that links an unlimited number of physical addresses to one account. When an address is added, the script checks the fields and puts the contents of each field into the corresponding array. It also counts the number of times this happens to make it easier to loop through my arrays on the server and make an insert statement for the database. Is there a way to send these arrays back to the server through post, and if so, how do I make them readable to PHP?
EDIT: Rafe Kettler's comment below helps a lot. It's exactly what I need, and makes my job a ton easier. Thanks for the help. The "Answer" I selected reflects the type of coding I will need to do and has shown me that 1) it's possible and 2) it's not all that difficult.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jQuery.post
http://api.jquery.com/jQuery.post/
示例:
js:
php:
jQuery.post
http://api.jquery.com/jQuery.post/
Sample:
js:
php:
您可以尝试 序列化 和 反序列化数组
You could try serializing and unserializing the array