dongtang5229 2017-04-19 09:56
浏览 134
已采纳

Ajax失败但发送了消息

Hey guys I am trying to send a message through form craft plugin but i get this error "jquery.js:4 POST http://www.Myurl.co.uk/wp-admin/admin-ajax.php 504 (Gateway Time-out)" and these details

send        @   jquery.js:4
ajax        @   jquery.js:4
(anonymous) @   booking_modal.js:3
dispatch    @   jquery.js:3
r.handle    @   jquery.js:3

But message is sent even if i get 'Ajax fail' error. What should i do? I am looking for a solution but cant figure out one. Also in custom.js:1791 undefined error there is this code. Should i change anything?

    jQuery(document).ready(function($) {
        /*  Show mini cart */
        $('#show-mini-cart-button').click(function(event) {
            /* Act on the event */
            $(this).parent().find('.traveler-cart-mini').toggleClass('open');
            return false;
        });

        $('.i-check').on('ifChanged', function(){
            var t = $(this);
            setTimeout(function(){ // I GET THE ERROR HERE I THINK
                var url = t.data('url');
                console.log( url );
                if (url) {
                    window.location.href = url;
                }
            }, 500);
        });
    });

I am new to this... If you need any other option please let me know or don't get mad if don't do right question please.. Any ideas would be helpful

  • 写回答

1条回答 默认 最新

  • donglu8334 2017-04-19 10:10
    关注

    Is the URL you are redirecting to on your own site? You should be able to check Apache (or NginX) logs, or PHP error_log.

    It looks like this is not the code causing your problem. Your error was

    jquery.js:4 POST http://www.Myurl.co.uk/wp-admin/admin-ajax.php 504 (Gateway Time-out)
    

    However, your code above that redirects is:

    window.location.href = url;
    

    That is just calling a URL, which means you are sending a GET request there.

    Chek in the Firefox Web Inspector network panel to see what request is being fired, and which headers/vars were sent. That way you should be able to find your offending code and continue debugging.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题