将对象和值呈现为JSON作为ajax响应 [英] Render Object and Value as JSON as ajax response

查看:92
本文介绍了将对象和值呈现为JSON作为ajax响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  render [assignedSchol:assignedSchol,scholType:scholType] as JSON 

assignedSchol是一个对象,scholType只是一个值。我得到一个没有地图条目允许在这个地方的错误。任何帮助?

解决方案

这应该是工作:

  render(contentType:application / json){[assignedSchol:assignedSchol,scholType:scholType]} 


I am trying to do the following:

render [assignedSchol:assignedSchol,scholType:scholType] as JSON

assignedSchol is an object, and scholType is just a value. I get a "No map entry allowed at this place error". any help?

解决方案

This should work:

render(contentType: "application/json") {[assignedSchol:assignedSchol,scholType:scholType]}

这篇关于将对象和值呈现为JSON作为ajax响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆