Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我的jQuery Ajax请求不起作用_Jquery_Ajax_Wordpress_Woocommerce - Fatal编程技术网

为什么我的jQuery Ajax请求不起作用

为什么我的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(

我正在尝试使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(data){
        alert(data);
    });

alert ("finish");

}
还有我的PHP文件

<?php

echo "Response from server";

?>

我希望有人能指出我做错了什么。

$
在WordPress中不起作用

您必须使用:

jQuery.get()

jQuery的
$
快捷方式在Wordpress中不起作用。如果您更容易使用它编写代码,您可以使用以下代码包装您的代码:

(function($) {


})( jQuery );
它将使用
$
别名
jQuery

(function($) {


})( jQuery );