开发者

Declaring a javascript object literal in Script#

I am trying to replicate a jquery ajax call in Script# and in the data option I am passing an object literal

{ id: target.data("id"), name: newName}

I am trying to reproduce this in Script#, but I am currently unsuccessful. The first thing that ca开发者_运维知识库me to mind was an anonymous object:

new { id = target.GetDataValue("id"), name = newName }

but that didn't seem to work.

Any ideas?


Try

new Dictionary("id", target.GetDataValue("id"), "name", newName)

or

Script.Literal("{ id: target.data(\"id\"), name: newName}")

Both should translate to your original code more or less.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜