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.
精彩评论