简体   繁体   English

我如何解决 IE 中的这个错误? SCRIPT1003:应为“:”

[英]How can i solve this error in IE ? SCRIPT1003: Expected ':'

var dataOpt = {
          @foreach($options as $option)
                    @if($option->option_type == 0)
                         Select_{{ $option->id}},
                    @endif
                    @if($option->option_type == 1)
                                    ImageRadio,
                    @endif
          @endforeach
          product_id : {{$product->id}
   };

Note : This code works in Chrome but in IE 11 returns the error:注意:此代码适用于 Chrome,但在 IE 11 中返回错误:

SCRIPT1003: Expected ':' on line 5. 

I'd really appreciate any help.我真的很感激任何帮助。 Does anybody have an idea?有人有想法吗?

Your output is not valid json.您的输出不是有效的 json。 Your properties do not have values and their names should be enclosed in double quotes.您的属性没有值,它们的名称应该用双引号括起来。 You could try something like the following:您可以尝试以下操作:

{
  "options": ["Select_3", "Select_4", "Select_13"],
  "product_id": 10
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM