为什么我的jQuery Ajax请求不起作用
我正在尝试使jQuery$.get请求工作。我已经将代码剥离到最基本的部分,但我仍然无法理解问题所在 这是我的js:为什么我的jQuery Ajax请求不起作用,jquery,ajax,wordpress,woocommerce,Jquery,Ajax,Wordpress,Woocommerce,我正在尝试使jQuery$.get请求工作。我已经将代码剥离到最基本的部分,但我仍然无法理解问题所在 这是我的js: function process_order_meta_changes(item_id) { alert ("start"); $.get("http://localhost/dropbox/woocommerce_test/wp-content/themes/storefront-child2/process_meta_update.php", function(
function process_order_meta_changes(item_id) {
alert ("start");
$.get("http://localhost/dropbox/woocommerce_test/wp-content/themes/storefront-child2/process_meta_update.php",
function(data){
alert(data);
});
alert ("finish");
}
还有我的PHP文件
<?php
echo "Response from server";
?>
我希望有人能指出我做错了什么。
$
在WordPress中不起作用
您必须使用:
jQuery.get()
jQuery的
$
快捷方式在Wordpress中不起作用。如果您更容易使用它编写代码,您可以使用以下代码包装您的代码:
(function($) {
})( jQuery );
它将使用$
别名jQuery
(function($) {
})( jQuery );