未捕获到的SyntaxError:意外令牌<在solr [英] Uncaught SyntaxError: Unexpected token < in solr
问题描述
我正在尝试在solr服务器中添加新文档. 我的代码
I am trying to add a new document in the solr server. My Code
$.ajax({
type: "POST",
url: "http://192.168.10.113:8080/solr/update/json?commit=true",
data: { "add": { "doc": { 'id': '19990' } } },
dataType: 'jsonp',
crossDomain: true,
jsonp: 'json.wrf',
success: function (data) { alert(data); },
failure: function (errMsg) {
alert(errMsg);
}
});
我的Solr服务器托管在不同的域中,所以我写了
My Solr server is hosted in different domain so i wrote
dataType: 'jsonp',
crossDomain: true,
jsonp: 'json.wrf',
克服来自跨域问题.
现在它显示未捕获的SyntaxError:意外令牌< 错误 我在Google上搜索. 最多的专家建议检查html和js代码. 我检查了罚款.没有多余的<符号在那里. 错误图片
Now it is showing Uncaught SyntaxError: Unexpected token < Error I searched on Google. maximum of experts suggested that to check in the html and js code. I checked its fine.No extra < symbol is there. Error Image
之后,我将URL更改为 http://192.168.10.113:8080/solr/update/json?commit=true到http://192.168.10.113:8080/solr/update/xml?commit=true
After that i changed the URL from http: //192.168.10.113:8080/solr/update/json?commit=true to http: //192.168.10.113:8080/solr/update/xml?commit=true
现在它显示错误链接
获取http://192.168.10.113:8080/solr/update/xml?commit=true&json.wrf=jQuery1710918970147613436_1351693492662&add%5Bdoc%5D%5Bid%5D=19990&_=1351693497692 405(不允许的方法)
请帮助我解决这个问题.
Please help me to solve this problem.
谢谢
推荐答案
这表明显示未捕获的SyntaxError:意外的令牌< 错误,因为服务器正在发送xml数据.
This was showing Uncaught SyntaxError: Unexpected token < error because the server is sending xml data.
将json声明为输入参数.因此我将服务器设置为json,这样就不会发生此类错误.
Declare json as input parameter.So I set the server as json,so that this type of error will not occur.
这篇关于未捕获到的SyntaxError:意外令牌<在solr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!