当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to increment an indexed field in Solr?

问题描述:

I want to increment a field of an indexed file each time the link to that file is clicked.

At the moment when a link is clicked on, this section of code (in JavaScript) is run:

$http({

url: 'http://localhost:8983/solr/mybb/update/json?commit=true',

params: {

'wt': 'json',

'id': $scope.id,

'visits': { 'inc': 1 }

}

})

.success(function(data) {

console.log("UPDATE SUCCESSFUL!");

})

.error(function() {

console.log("UPDATE FAILED!");

});

When I this is run I get the error:

XMLHttpRequest cannot load

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

Could someone please assist me in correcting this?

网友答案:

This is a CORS related error . You need to make a jsonp request to counter that . Read more about CORS and jsonp , i believe that will help you understand better .

分享给朋友:
您可能感兴趣的文章:
随机阅读: