Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
单击按钮,使用ajax运行php函数_Php_Jquery_Ajax_Forms_Safari - Fatal编程技术网

单击按钮,使用ajax运行php函数

单击按钮,使用ajax运行php函数,php,jquery,ajax,forms,safari,Php,Jquery,Ajax,Forms,Safari,当我点击这个按钮时,我想运行我的php函数,这在Chrome和Firefox上运行良好,但在Safari上不行,我不知道为什么:(请帮助我 我的PHP函数是:complete_automation_xml(); 我的按钮是:Verstuur电子邮件 我的代码是: <script> jQuery(document).ready(function($) { $('#btn').click(function(){ $.ajax({

当我点击这个按钮时,我想运行我的php函数,这在Chrome和Firefox上运行良好,但在Safari上不行,我不知道为什么:(请帮助我

我的PHP函数是:complete_automation_xml(); 我的按钮是:
Verstuur电子邮件
我的代码是:

<script>
    jQuery(document).ready(function($) {
    $('#btn').click(function(){

        $.ajax({
            type: "POST",
            url: '../wp-admin/admin.php?page=spd_xml_importer',
            data: {action: 'call_this'},
            success: function (html) {
                alert(html);
            }

        });
    });
});
</script>
<div class="email-bt">
    <script>function alertWithoutNotice(message) {
            setTimeout(function () {
                alert('E-mails zijn verzonden');
            }, 300);
        }</script>
        <button id="btn" onclick="alertWithoutNotice();" class="deletebtn button button-next">Verstuur E-mails</button>
</div>
<?php
if ($_POST['action'] == 'call_this') {
    complete_automate_xml();
}

jQuery(文档).ready(函数($){
$('#btn')。单击(函数(){
$.ajax({
类型:“POST”,
url:“../wp admin/admin.php?page=spd\u xml\u importer”,
数据:{action:'call_this'},
成功:函数(html){
警报(html);
}
});
});
});
函数alertwithout通知(消息){
setTimeout(函数(){
警报(“电子邮件zijn verzonden”);
}, 300);
}
Verstuur电子邮件

我的想法更像这样——但我不能100%确定这是Safari的问题,我只是想知道浏览器中是否存在调用哪个函数的混淆

<script>
    jQuery(document).ready(function($) {
    $('#btn').click(function(){
        setTimeout(function() {
            alert('E-mails zijn verzonden');
        }, 300);

        $.ajax({
            type: "POST",
            url: '../wp-admin/admin.php?page=spd_xml_importer',
            data: { action: 'call_this' },
            success: function (html) {
                alert(html);
            }
        });
    });
});
</script>
<div class="email-bt">
        <button id="btn" class="deletebtn button button-next">Verstuur E-mails</button>
</div>

jQuery(文档).ready(函数($){
$('#btn')。单击(函数(){
setTimeout(函数(){
警报(“电子邮件zijn verzonden”);
}, 300);
$.ajax({
类型:“POST”,
url:“../wp admin/admin.php?page=spd\u xml\u importer”,
数据:{action:'call_this'},
成功:函数(html){
警报(html);
}
});
});
});
Verstuur电子邮件

我的想法更像这样-但我不能100%确定这是Safari的问题,我只是想知道浏览器中是否存在调用哪个函数的混淆

<script>
    jQuery(document).ready(function($) {
    $('#btn').click(function(){
        setTimeout(function() {
            alert('E-mails zijn verzonden');
        }, 300);

        $.ajax({
            type: "POST",
            url: '../wp-admin/admin.php?page=spd_xml_importer',
            data: { action: 'call_this' },
            success: function (html) {
                alert(html);
            }
        });
    });
});
</script>
<div class="email-bt">
        <button id="btn" class="deletebtn button button-next">Verstuur E-mails</button>
</div>

jQuery(文档).ready(函数($){
$('#btn')。单击(函数(){
setTimeout(函数(){
警报(“电子邮件zijn verzonden”);
}, 300);
$.ajax({
类型:“POST”,
url:“../wp admin/admin.php?page=spd\u xml\u importer”,
数据:{action:'call_this'},
成功:函数(html){
警报(html);
}
});
});
});
Verstuur电子邮件

控制台中的safari中是否存在js错误?什么都没有:(但当我单击按钮时,它不会运行php,,非常奇怪的是有一个内联函数和一个通过
onload
处理程序连接的函数-几乎有两个相互竞争的函数。你能将两者结合起来吗?可以:)我将在belowe发布,作为回答,请参考,如果您有空闲时间,控制台中的safari是否存在js错误?无:(但当我点击按钮时,它不会运行php,,,非常奇怪的是,有一个内联函数和一个通过
onload
处理程序连接的函数-几乎有两个相互竞争的函数。你能将这两个函数结合起来吗?可以:)我将在belowe发布,作为回答,如果您有空闲时间,请参考。非常感谢,但不幸的是,它也不起作用,与Chrome完美搭配,但与Safari不搭配:(遗憾的是,我没有Safari可供测试-因此我甚至不知道Safari是否有一个控制台可用于帮助调试。在Safari中,单击会触发任何东西吗?没关系,朋友:)很高兴你能帮上忙。是的,它确实有一个控制台,JS工作得很好,尽管$\u POST没有。无论如何,我只想在用户点击按钮时运行php函数。只是控制台有问题,AJAX不能正常运行,问题是AJAX。非常感谢,但不幸的是,它也不工作,性能使用Chrome但不使用Safari的ct:(遗憾的是,我没有Safari可供测试-因此我甚至不知道Safari是否有一个控制台可帮助调试。在Safari中,点击触发任何东西吗?没关系,朋友:)很高兴你帮了我很多忙。是的,它有一个控制台,JS运行得很好,尽管$u POST没有。无论如何,我只想在用户点击按钮时运行php函数。只是控制台有问题,AJAX不能正常运行,问题是AJAX