我有一个返回结果整个PHP脚本一个非常简单的Hello World Ajax的PHP的例子。 下面的代码:
客户代码:
$.ajax({
type: "GET",
contentType: "text",
url: "hello-world.php",
success: function(data){
$("#myDiv").text(data);
console.log(data);
}
});
服务器代码:
<?php
// A simple web site in Cloud9 that runs through Apache
// Press the 'Run' button on the top to start the web server,
// then click the URL that is emitted to the Output tab of the console
echo 'Hello world!';
?>
这里的控制台日志:
<?php
// A simple web site in Cloud9 that runs through Apache
// Press the 'Run' button on the top to start the web server,
// then click the URL that is emitted to the Output tab of the console
echo 'Hello world!';
?>
谢谢!