doubomudichen0832 2018-04-01 09:07
浏览 49
已采纳

如何用AJAX调用PHP函数[重复]

This question already has an answer here:

everyone, I am having a hard time understanding how AJAX works. If anyone could help me, I need that when a button with onclick="CallFunction()" is clicked, it would execute a PHP function CreateBet();

This is my only current HTML:

<html>
<div style="margin: 0 auto; width: 500px; height: 500px; border: 1px solid black;">
<button onclick="CreateBet()" type="button">Create Bet</button>
</div>
</html>

Thank you in advance :)

</div>
  • 写回答

1条回答 默认 最新

  • doudai3012 2018-04-01 09:10
    关注
    <input type="button" name="c1" value="pt" onclick="filter()">
    

    it will call the filter function of ajax.

    function filterPrice() {
    
                $.ajax({
                    url: "Filter.php", //url for php function
                    type: "POST",
                    data: sendData, // data to sent
                    dataType: 'json',
                    success: function (data)
                    {
    
                    }
                });
            }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?