$("#get-results").submit(function (event) {
console.log("Submitting new analysis...");
event.preventDefault();
//$("#question-submit").prop("disabled", true);
var question = $('#question').val();
var url1 = "https://@gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/solr/example_collection/fcselect?ranker_id=868fedx13-rank-702&q=does it support encryption &wt=json&fl=id,title,body";
$.ajax({
type: "POST",
url : url1,
dataType : 'jsonp',
jsonpCallback : 'callback',
});
// JSONP Callback
function callback(response) {
//var glacier = JSON.parse(response);
alert("Response from cross origin: " + response);
}
}); SyntaxError:缺失;语句前{"responseHeader":{"status":0,"QTime":70}," response ":{"numFound":109,"start":|_________________^为返回
发布于 2016-04-09 18:32:03
响应是json,但您使用的是dataType=“JSON”-json不是json。Change dataType: 'jsonp' to dataType: 'json'
你应该在这里查看更多信息:AJAX call and clean JSON but Syntax Error: missing ; before statement
https://stackoverflow.com/questions/36497730
复制相似问题