我有一个 Ruby 变量:
@json = [{"lat":37.8690058,"lng":-122.2555342},{"lat":37.8739362,"lng":-122.2653001},{"lat":37.8701101,"lng":-122.2578559}]
当我尝试:
<script type="text/javascript" charset="utf-8">
var test = <%= @json %>
console.log(test);
</script>
萤火虫告诉我:
invalid property id
var test = [{"lat":37.869005...707408,"lng":-122.2545767}]
如何成功设置变量?