我在http://language.cs.usm.my/synthesis/read.php的表單上有一個textarea。此URL是第三方網頁,我如何將我的內容發佈到該URL並替換現有的textarea內容。
到目前爲止,我嘗試使用下面的方法將我的內容發佈到URL,但它似乎沒有這樣做。
$scope.AudioCont = function(){
var req = $http({
method: 'POST',
url: 'http://language.cs.usm.my/synthesis/read.php',
data:{
test:"Nama saya ialah Ali"
}
})
.then(
function (response) {
alert("The data has been posted");
console.log(response);
},
function() {
alert("Failed to post!");
})
}
任何人對此有何建議?預先感謝。
使用dataType:'jsonp'在構建參數時執行跨站點請求。 – siimsoni
如果[CORS已啓用](http://stackoverflow.com/questions/25845203/understanding-cors),則無法發佈到其他域。 [跨域後](http://stackoverflow.com/a/2699351/2246862) –