我想
在单击此按钮时运行我的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();
}
我的想法更像这样 - 但我不是 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>