1
使用AngularJS,我發送一個JSONP請求到服務器,它不返回任何東西。成功回調仍然執行。有誰知道爲什麼?它只是添加一個空的腳本到頁面?AngularJS:JSONP請求到沒有回調的服務。爲什麼這個工作?
我有這樣的前端:
$scope.send = function(forms){
$http.jsonp('http://myserver.com/write.php?formsJSON='+JSON.stringify(forms)).success(alert('Saved on server'));
}
而且這個後端:
<?php
if (!(isset($_GET['formsJSON']))) {
exit("formsJSON not set, exiting...");
}
$file = 'people.txt';
file_put_contents($file, $_GET['formsJSON']);
?>
問題是什麼,你說你有什麼後端,但我沒有看到? –
我剛寫完。 – user2939415