简体   繁体   English

在Polymer core-ajax中传递嵌套对象

[英]Passing nested objects in Polymer core-ajax

I am trying to pass a nested object to Polymer core-ajax. 我试图将嵌套对象传递给Polymer core-ajax。 Here is the code: 这是代码:

<core-ajax url="DSPUser1.php" method="POST" on-core-response="{{responseventDSPUser}}" params='{"userID":"Anon", "transactionType":"DSPUser", "payload":{"id":"1"}}' handleAs="json" id="transactionDSPUser" response="{{msgout}}">``

When I look at the POST in the Chrome tools I see the following under Form Data: 当我在Chrome工具中查看POST时,在Form Data下看到以下内容:

userID:Anon
transactionType:DSPUser
payload:[object Object]

It looks as if core-ajax is not handling nested objects. 似乎core-ajax没有处理嵌套对象。

Is this a feature or a bug? 这是功能还是错误?

Should I be using body instead of params? 我应该使用身体代替参数吗?

Regardless is there a way to pass a nested object using core-ajax? 无论如何,都可以使用core-ajax传递嵌套对象?

PS When I use JQuery $.POST Chrome shows the following for Form Data for a similar request PS当我使用JQuery $ .POST时,Chrome对类似的请求显示以下表单数据

transactionType:DSPUSER
userdID:Anonymous
securityToken:
payload[iD]:1

If Im not wrong, params are converted into queryString. 如果Im没错,则将参数转换为queryString。 For POST operations you should use body instead. 对于POST操作,应改用body。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM