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
Jquery 如何通过ajax在结账时刷新订单审核?_Jquery_Ajax_Wordpress_Woocommerce - Fatal编程技术网

Jquery 如何通过ajax在结账时刷新订单审核?

Jquery 如何通过ajax在结账时刷新订单审核?,jquery,ajax,wordpress,woocommerce,Jquery,Ajax,Wordpress,Woocommerce,在我的WooCommerce插件中,我使用的是shipping city字段。选择城市后,我想通过ajax刷新订单审查。 以下是JS: jQuery('input.city-search').autocomplete({ serviceUrl: ajax.url, paramName: 's', params: { action: 'wp_ajax_city_search' }, transformResult: function(resp

在我的WooCommerce插件中,我使用的是shipping city字段。选择城市后,我想通过ajax刷新订单审查。 以下是JS:

jQuery('input.city-search').autocomplete({
    serviceUrl: ajax.url,
    paramName: 's',
    params: {
        action: 'wp_ajax_city_search'
    },
    transformResult: function(response) {
        response = jQuery.parseJSON(response);
        return {
        suggestions: jQuery.map(response, function(item) {
            return { 
                value: decode_html(item.text), 
                data: item.data
            };
        })
    };
    },
    onSelect: function (suggestion) {
        jQuery( 'body' ).trigger( 'update_checkout' );
    }
});
问题在于
jQuery('body').trigger('update\u checkout')
什么都不做。
我也尝试了
$(document.body).trigger('update\u checkout')
,但结果是一样的-什么都没有。我试图检查是否有任何事件绑定到body-
jQuery('body')。数据('events')
,但它显示没有任何事件。

尝试在
onSelect
中放置警报,以确保它确实正在触发。@Anand谢谢。我做到了,它发射得很好。但“更新签出”事件仍然没有成功