【发布时间】:2014-02-07 11:51:20
【问题描述】:
我需要将一些数据发布到 URL。我需要得到我的对象:
var profile = {
firstname: first_name,
lastname: last_name,
email: email,
phone: phone,
mobile: mobile,
address_1: address_1,
address_2: address_2,
city: city,
postcode: postcode,
};
像表单一样发送到端点。即一个数组
profile[firstname] = "Billy"
profile[lastname] = "Jones"
...
我的标题Content-Type:
Content-Type application/x-www-form-urlencoded; charset=utf-8
由于某种原因,我无法弄清楚如何将其作为表单数组而不是 JSON 字符串发送。
【问题讨论】:
-
你是用jquery发送的吗?
-
@VladIoffe nope 使用网络客户端开发钛应用程序 - docs.appcelerator.com/titanium/latest/#!/api/…
-
为什么不使用 json 字符串?根据您使用的序列化程序,很容易将其反序列化为服务器端的 Dictionary
或键值对列表。
标签: javascript ajax arrays json