我有一個PHP文件(treatment.php),其中包含了一些功能的功能,例如:呼籲PHP文件中使用jQuery
public function connexion(){
$user = 'invité';
if($_POST){
if(isset($_POST['user'])) {
session_start();
$user = $_POST['user'];
}
}
echo $user;
}
而且我想通過Ajax用下面的代碼來調用這個函數,但它不起作用:
$(document).on("click", "#valider-btn", function(){
$.ajax({
url : 'treatment.php/Connexion',
type : 'POST',
data : 'user=' + $("#name").val(),
dataType : 'html',
success : function(donnees) {
$("#name").val("");
$("#formulaire").hide();
$("#decompte").html(donnees);
}
});
});
那麼有人可以幫忙嗎?謝謝
包括another.php頁進first.php由全光照和AJAX將another.php的內容設置爲first.php。通過這種方式,another.php代碼將在first.php上執行一些操作後執行。 –