Php 当变量包含数据时执行ajax

Php 当变量包含数据时执行ajax,php,html,ajax,Php,Html,Ajax,我有一个会话变量email=$\u GET['email'],我想在变量可用时执行ajax函数,在变量不可用时不执行任何操作 变量可用时如何调用ajax函数?您可以使用: <?php if(isset($_GET['email']) && $_GET['email'] !='') {?> <script> // your ajax function comes here </script> <?php }

我有一个会话变量email=$\u GET['email'],我想在变量可用时执行ajax函数,在变量不可用时不执行任何操作

变量可用时如何调用ajax函数?

您可以使用:

<?php if(isset($_GET['email']) && $_GET['email'] !='') {?>
    <script>
        // your ajax function comes here
    </script>
<?php } ?> 

您可以使用javascript编写Php代码

变量emial=; $.ajax{ //您的ajax代码
};我试着用按钮点击功能,但不知道什么时候该做的功能是可用的邮政编码。你真的没有想到会有人坐下来为你写这整件事。是吗?是的,我犯了那个错误!您无需使用isset和!=,对其进行两次检查,使用空$\u获取['email']instead@Mohammad是的,你是对的,我们两种选择都可以。