如何在jquery中访问模型属性? [英] How do you access a model attribute in jquery?

查看:60
本文介绍了如何在jquery中访问模型属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在春季将对象添加到我的ModelAndView并转发到我的jsp视图.我需要在我的jquery中访问该对象.如果不先将值放在隐藏字段中,是否有可能?怎么做?

I'm adding an object to my ModelAndView in spring and forwarding to my jsp view. I need to access that object in my jquery. Is this possible without first putting the value in a hidden field? How is it done?

推荐答案

<script type="text/javascript">
   var modelAttributeValue = '${modelAttribute}';
</script>

这将解决由model.addAttribute("modelAttribute", value)

这篇关于如何在jquery中访问模型属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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