簡體   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);
    }

}); 

語法錯誤:丟失; 語句{“ responseHeader”:{“ status”:0,“ QTime”:70},“ response”:{“ numFound”:109,“ start”:| _________________ ^是響應之前

響應是JSON,但您使用的是dataType =“ jsonp”-jsonp不是json。 Change dataType: 'jsonp' to dataType: 'json'

您應該在此處查看更多信息: AJAX調用並清除JSON,但語法錯誤:missing; 聲明前

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM