Jquery を使用してOpen Calais API からデータを取得しようとしていますが、有効な応答が得られない場合。データ型 "script" を使用すると、"missing ; before statement." というエラーが発生します。データ型 "xml" などを使用すると、Open Calais サーバーから 403 エラーが発生します。
このカレーフォーラム投稿の最後のエントリに基づいて、「スクリプト」データ型を試すことにしました
私のコードに関する批評やコメントを差し控えないでください。行く度に傾いています。
私のコード:
var baseUrl="http://api.opencalais.com/enlighten/calais.asmx/Enlighten";
var licenseID="wt8h3w3pt333eewdwsyuhut6";
var content="In response to a legislative provision in a bill reauthorizing the FAA, the agency has launched a comment period as it selects six test sites to evaluate unmanned aircraft systems. The focus of the proceeding will be determining the location of the test sites along with establishing...";
var PARMS="&contentType=text/xml&outputFormat=xml/rdf"
var PostDatavar = "?licenseID="+licenseID+"&content="+encodeURIComponent(content)+PARMS;
var componentURL=baseUrl+PostDatavar;
function sendIt(sendData){
$.ajax({
url:componentURL,
type: "POST",
dataType:"script",
success:function(data){
alert(data));
console.log(data);
},
error:function(){
alert("it's broken");
}}
);
}