【发布时间】:2016-03-02 11:41:15
【问题描述】:
我想在单击此按钮时运行我的 php 函数,这在 Chrome 和 Firefox 上运行良好,但在 Safari 上不行,我不知道为什么 :( 请帮助我...
我的 PHP 函数是:complete_automate_xml();
我的按钮是:<button id="btn" onclick="alertWithoutNotice();" class="deletebtn button button-next">Verstuur E-mails</button>
我的代码是:
<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();
}
【问题讨论】:
-
控制台safari中是否有js错误?
-
没什么:(但是当我点击按钮时它不会运行php,很奇怪
-
有一个内联函数和一个通过
onload处理程序附加的函数似乎很奇怪——几乎是两个相互竞争的函数。你能把两者结合起来吗? -
会做的:) 我会在下面发帖,作为答案,如果你有空闲时间请参考
标签: php jquery ajax forms safari