小编Hen*_*nry的帖子

ajax 执行php函数

我如何使用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)

javascript php ajax jquery

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1

php ×1