Woocommerce wc-ajax返回html响应

时间:2017-02-14 16:54:45

标签: javascript php ajax wordpress woocommerce

问题出在结帐页面,"您的订单" section总是变灰并且spinner正在永远加载。

我关闭了 https ,Cloudflare,所有插件,已激活的默认主题,同样的行为仍然存在。

当我通过Chrome Dev,网络标签访问结帐页面时,我尝试调试正在发生的事情:

XHR POST请求被发送到/ checkout /?wc-ajax = update_order_review

这就是它变得奇怪的地方,代码200返回的响应实际上是一个HTML响应,它具有相同的页面而不是JSON对象,响应头是:

Request URL:https://alpha.seniorinafashion.com/checkout/?wc-ajax=update_order_review
Request Method:POST
Status Code:200 
Remote Address:104.31.91.108:443
Response Headers
cache-control:no-cache, must-revalidate, max-age=0
cf-ray:3312009e9e431a99-DUS
content-encoding:br
content-type:text/html; charset=UTF-8
date:Tue, 14 Feb 2017 16:47:31 GMT
expires:Wed, 11 Jan 1984 05:00:00 GMT
link:<https://alpha.seniorinafashion.com/?p=2724>; rel=shortlink
link:<https://alpha.seniorinafashion.com/wp-json/>; rel="https://api.w.org/"
server:cloudflare-nginx
set-cookie:woocommerce_cart_hash=771886deccd483983b22b6a8ac26f76e; path=/
set-cookie:wp_woocommerce_session_d3fe2e799745c6650de3e94ad8c9e5b5=59cfc776e38750ac597b0cc8396dca00%7C%7C1487260661%7C%7C1487257061%7C%7C887c63ae5a0e78a8c86f7622f03cd2d2; expires=Thu, 16-Feb-2017 15:57:41 GMT; Max-Age=169810; path=/
set-cookie:woocommerce_items_in_cart=1; path=/
set-cookie:woocommerce_cart_hash=771886deccd483983b22b6a8ac26f76e; path=/
set-cookie:wp_woocommerce_session_d3fe2e799745c6650de3e94ad8c9e5b5=59cfc776e38750ac597b0cc8396dca00%7C%7C1487260661%7C%7C1487257061%7C%7C887c63ae5a0e78a8c86f7622f03cd2d2; expires=Thu, 16-Feb-2017 15:57:41 GMT; Max-Age=169810; path=/
set-cookie:woocommerce_items_in_cart=1; path=/
status:200
x-frame-options:SAMEORIGIN
x-pingback:https://alpha.seniorinafashion.com/xmlrpc.php
Request Headers
:authority:alpha.seniorinafashion.com
:method:POST
:path:/checkout/?wc-ajax=update_order_review
:scheme:https
accept:*/*
accept-encoding:gzip, deflate, br
accept-language:en-US,en;q=0.8
content-length:836
content-type:application/x-www-form-urlencoded; charset=UTF-8
cookie:__cfduid=dcd5da450805c7fb21259f27cb677e8b51487087855; woocommerce_items_in_cart=1; woocommerce_cart_hash=771886deccd483983b22b6a8ac26f76e; wp_woocommerce_session_d3fe2e799745c6650de3e94ad8c9e5b5=59cfc776e38750ac597b0cc8396dca00%7C%7C1487260661%7C%7C1487257061%7C%7C887c63ae5a0e78a8c86f7622f03cd2d2
origin:https://alpha.seniorinafashion.com
referer:https://alpha.seniorinafashion.com/checkout/
user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
x-requested-with:XMLHttpRequest
Query String Parameters
view source
view URL encoded
wc-ajax:update_order_review
Form Data
view source
view URL encoded
security:47743ef2c2
payment_method:cod
country:DE
state:
postcode:
city:
address:
address_2:
s_country:DE
s_state:
s_postcode:
s_city:
s_address:
s_address_2:
post_data:billing_first_name=&billing_last_name=&billing_company=&billing_email=&billing_phone=&billing_country=DE&billing_address_1=&billing_address_2=&billing_postcode=&billing_city=&billing_state=&account_password=&shipping_first_name=&shipping_last_name=&shipping_company=&shipping_country=DE&shipping_address_1=&shipping_address_2=&shipping_postcode=&shipping_city=&shipping_state=&order_comments=&shipping_method%5B0%5D=flat_rate%3A1&payment_method=cod&terms-field=1&_wpnonce=794e840694&_wp_http_referer=%2Fcheckout%2F
shipping_method[0]:flat_rate:1

1 个答案:

答案 0 :(得分:1)

我有完全相同的问题,但是当我禁用固定链接时它会消失。禁用固定链接后,我得到了预期的JSON响应。