如何使用jQuery ajax调用PHP函数?

如何使用jQuery ajax调用PHP函数?,第1张

如何使用jQuery ajax调用PHP函数

在PHP中

<?php// create a list of approved function calls$approved_functions = array('sendForm','fn2');// check the $_GET['function'] and see if it matches an approved functionif(in_array($_GET['function'], $approved_functions)){    // call the approved function    $_GET['function']();}function sendForm(){    //save form}function fn2(){ //do something}

在AJAX中

// specify which function to callurl: "myfunctions.php?function=sendForm",


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4908178.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存