我想运行我的php功能,当我点击这个按钮,这适用于Chrome和Firefox的罚款,但不是在Safari上,我不知道为什么:(请帮助我...按钮点击,运行一个php函数与ajax
我的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错误? – rahul
没有:(但它不会运行PHP,当我点击按钮,,,很奇怪 –
似乎有一个内联函数和一个通过'onload'处理程序附加 - 两个竞争函数差不多,你可以结合这两个? – RamRaider