简体   繁体   English

我收到此错误SyntaxError:missing; 在Firefox语句显示错误之前

[英]I am getting this error SyntaxError: missing ; before statement firefox shows the error

$("#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: missing ; 语法错误:丢失; before statement {"responseHeader":{"status":0,"QTime":70},"response":{"numFound":109,"start": |_________________^ is the response 语句{“ responseHeader”:{“ status”:0,“ QTime”:70},“ response”:{“ numFound”:109,“ start”:| _________________ ^是响应之前

the response is a JSON but you are using dataType="jsonp" - jsonp is not json. 响应是JSON,但您使用的是dataType =“ jsonp”-jsonp不是json。 Change dataType: 'jsonp' to dataType: 'json'

you should check here for more information: AJAX call and clean JSON but Syntax Error: missing ; 您应该在此处查看更多信息: AJAX调用并清除JSON,但语法错误:missing; before statement 声明前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM