未捕获到的SyntaxError:意外令牌< [英] Uncaught SyntaxError: Unexpected token <

查看:62
本文介绍了未捕获到的SyntaxError:意外令牌<的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我正在尝试将数据存储在solr服务器中,但是页面显示错误
我的代码

hi all
I am trying to store data in the solr server but the page is showing error
My Code

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Include/JS/JqueryPlugin/jquery-1.8.2.min.js"></script>
<script>
    function save() {
        try {
            $.ajax({
                type: "POST",
                url: "http://192.168.10.113:8080/solr/update/json?commit=true",
                data: { "add": { "doc": { "id": "222222", "name": "Ruby on Trails" } } },
                contentType: "application/json; charset=utf-8",
                dataType: 'jsonp',
                crossDomain: true,
                jsonp: 'json.wrf'
            });
        }
        catch (err) {
            alert(err);
        }
    }
</script>
</head>
<body>
<input type="button" id="button" onclick="save()" value="Submit" />
</body>
</html>


像这样显示错误
未捕获的SyntaxError:意外令牌
如何克服这个问题.我在Google上进行搜索,发现html页或js页中的语法错误.
但就我而言,没有错误.

您可以在此处
看到错误 请帮助解决此错误.

在此先感谢


Its showing error like this
Uncaught SyntaxError: Unexpected token
how to over come from this problem. I searched on google and found that syntax error in the html page or in js page .
But in my case there no error.

You can see the error here
please help to solve this error.

Thanks in advance

推荐答案

.ajax({ 类型:" , 网址:" , 数据:{" :{" doc":{ id" :" " 名称": Ruby on Trails"}} }, contentType:" , dataType:' jsonp', crossDomain: true , jsonp:' json.wrf' }); } 捕获(错误){ 警报(err); } } < / 脚本 > < /head > < 正文 > < 输入 =" 按钮" id 按钮" onclick =" save()" 提交" / > < /body > < /html >
.ajax({ type: "POST", url: "http://192.168.10.113:8080/solr/update/json?commit=true", data: { "add": { "doc": { "id": "222222", "name": "Ruby on Trails" } } }, contentType: "application/json; charset=utf-8", dataType: 'jsonp', crossDomain: true, jsonp: 'json.wrf' }); } catch (err) { alert(err); } } </script> </head> <body> <input type="button" id="button" onclick="save()" value="Submit" /> </body> </html>


像这样显示错误
未捕获的SyntaxError:意外令牌
如何克服这个问题.我在Google上进行搜索,发现html页或js页中的语法错误.
但就我而言,没有错误.

您可以在此处
看到错误 请帮助解决此错误.

预先感谢


Its showing error like this
Uncaught SyntaxError: Unexpected token
how to over come from this problem. I searched on google and found that syntax error in the html page or in js page .
But in my case there no error.

You can see the error here
please help to solve this error.

Thanks in advance


看起来像xml不正确.看看第一行,"UTF-8"之后的两个字符.它看起来不正确(因为分辨率很低,所以无法确切看到它是什么)

祝你好运!
Looks like the xml isn''t correct. Have a look at the first line, the two characters after "UTF-8". It doesn''t look right (cannot see exactly what it is though because the resolution is quite low)

Good luck!


这篇关于未捕获到的SyntaxError:意外令牌&lt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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