所以,我有以下爲Ajax:Ajax表單只能在線
//Ajax
jQuery(document).ready(function() {
jQuery('.my_popup_contact_open').click(function(e) {
e.preventDefault();
jQuery.ajax({
type: "GET",
url: "<?php echo admin_url('admin-ajax.php'); ?>",
dataType: 'html',
data: ({ action: 'rh_contact_form_support'}),
success: function(data){
jQuery('.rhm_contact_support').html(data);
},
error: function(data)
{
alert("Error!");
return false;
}
});
});
});
對於我my_js.js
文件,我有以下設置:
//header script:
(function ($, root, undefined) {
$(function() {
'use strict';
//js goes here
// Default line End
});
})(jQuery, this);
當我把AJAX JS在my_js.php
,該功能不起作用。當我把代碼內聯在php頁面的底部時,它似乎只能工作。
任何建議爲什麼當它放置在「my_js.js」時它不起作用?
謝謝!
我得到了505錯誤。 –