我如何使用ajax执行php函数。我的脚本页面上有多个函数,但我想使用 ajax 调用单个函数
<?php
function one(){return 1;}
function two(){return 2;}
?>
Run Code Online (Sandbox Code Playgroud)
<?php
function one(){return 1;}
function two(){return 2;}
?>
Run Code Online (Sandbox Code Playgroud)
$("#form").on('submit',(function(e){
e.preventDefault();
$.ajax({
url: "process.php",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(response){
alert(response);
}
});
}));Run Code Online (Sandbox Code Playgroud)