uncaught syntaxerror unexpected token U JSON

The parameter for the JSON.parse may be returning nothing (i.e. the value given for the JSON.parse is undefined)!

It happened to me while I was parsing the Compiled solidity code from an xyz.sol file.

import web3 from './web3';
import xyz from './build/xyz.json'; const i = new web3.eth.Contract(
JSON.parse(xyz.interface),
'0x99Fd6eFd4257645a34093E657f69150FEFf7CdF5'
); export default i;

which was misspelled as

JSON.parse(xyz.intereface)

which was returning nothing!

看了一下本地的代码,传递给函数的参数是$('#ctl00_cphMain_ucProfile_Avatar_hffulList').val(),

在Chrome的console的控制台运行,发现返回结果是undefined,

在html里面搜索了一下ctl00_cphMain_ucProfile_Avatar_hffulList,发现这个元素不存在

uncaught syntaxerror unexpected token U JSON的更多相关文章

  1. JSON.parse()——Uncaught SyntaxError: Unexpected token \ in JSON at position 1

    背景:项目安全处理方面之一 ——对特殊字符进行编解码(后端编码,前端解码) 特殊字符: "    %22 \    %5C /    %2F &   %26 %   %25 '    ...

  2. Uncaught SyntaxError: Unexpected token ' in JSON at position 1

    听说js是一样很BT的语言,今天真是有点领教到了. 用python3.6+django2.0开发网站时,遇到了一个坑中之坑! 在异步数据提交Ajax的运用中,不免在回调函数中使用到JSON.parse ...

  3. 关于Uncaught SyntaxError: Unexpected token o in JSON at position 1,chrome持续报错的相关解析

    今天跟大家分享我前两天遇见的一个BUG,说出来很难受,因为这个BUG花了我一个多小时去找原因,后来莫名其妙的故障消失了,强迫症犯了的我,居然花了2个多小时去故意再制造这个BUG,只想弄明白WHY??? ...

  4. json格式字符串用Uncaught SyntaxError: Unexpected token ' Uncaught SyntaxError: Unexpected number

    Unexpected number(index)的错误用的json字符串如 var jsonStr = "{1:'北京note备注信息',2:'上海note备注信息',3:'广东note备注 ...

  5. Atitit  Uncaught (in promise) SyntaxError Unexpected token < in JSON at position 0

    Atitit  Uncaught (in promise) SyntaxError  Unexpected token < in JSON at position 0  Uncaught (in ...

  6. VM603:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1

    再用JQuery解析json的时候出现了这样一个问题 VM603: Uncaught SyntaxError: Unexpected token o 通过查阅资料发现,是由于解析json文件的时候解析 ...

  7. SyntaxError: Unexpected token ' in JSON at position 2

    js中字符串转json对象时报错: Uncaught SyntaxError: Unexpected token s in JSON at position 2 解决方法: js中获取jsp的返回值 ...

  8. jquery使用ajax报错[Uncaught SyntaxError: Unexpected token :]

    $.post('/ajax/validate.do',{"id": id},function(ret){ //ret }); 返回值明明是json,格式也是正确的,却解析不成功,在 ...

  9. Uncaught SyntaxError: Unexpected token : 开发遇到的跨域问题

    先描述一下,这个问题,是如何遇到的 在ajax调用远程服务的时候,报了一个Origin xxxxxx is not allowed by Access-Control-Allow-Origin 的错误 ...

随机推荐

  1. cx_Oracle 操作oracle数据库

    cx_Oracle 操作oracle数据库 class MyOracle(): def __init__(self, host_name="ip", port=1521, sid= ...

  2. Win10+Linux(CentOS) 双系统安装教程--踩坑实录

    最近心血来潮想给自己的笔记本装一套linux系统作为开发环境, 说干就干,首先先收集一下现在linux主流版本, 貌似现在市场上应用服务器比较多的是redhat相关产品,而ubuntu的优势在于它庞大 ...

  3. puppet之模板和类

    puppet之模板和类 不同节点布置资源 vim /etc/puppet/manifests/site.pp 1 import "nodes/*.pp" 建立节点文件 mkdir ...

  4. 22_4mybatis——动态SQL

    1.创建maven工程并导入坐标 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE confi ...

  5. ui自动化之selenium操作(一)环境搭建

    1. python安装: 前面步骤可以看到,这里就不赘述了(我们在这里安装的是python3) 2. selenium安装: 前面我们都已经安装好pip了,所以这里咱们直接进入到python安装路径的 ...

  6. 单调队列优化DP || [Poi2014]Little Bird || BZOJ 3831 || Luogu P3572

    题面:[POI2014]PTA-Little Bird 题解: N<=1e6 Q<=25F[i]表示到达第i棵树时需要消耗的最小体力值F[i]=min(F[i],F[j]+(D[j]> ...

  7. 代码管理工具 Git

    之前一直使用微软的代码管理工具TFS(Team Foundation Server)..NET CORE 2.0的发布后,考虑到.NET CORE项目可以跨平台,准备把项目迁移到.NET CORE 环 ...

  8. Docker(3)--常用命令

    1.docker -h 帮助 2.获取镜像 docker pull NAME[:TAG] [root@node3 ~]#docker pull centos:latest 3.启动Container盒 ...

  9. ftp CentOS7安装

    1.安装ftp服务yum install vsftpd 2.修改ftp配置文件(/etc/vsftpd/vsftpd.conf)ascii_upload_enable=YESascii_downloa ...

  10. 【leetcode】1213.Intersection of Three Sorted Arrays

    题目如下: Given three integer arrays arr1, arr2 and arr3 sorted in strictly increasing order, return a s ...