S
S
Sergey Defactov2017-11-26 17:36:02
PHP
Sergey Defactov, 2017-11-26 17:36:02

503 error on Ajax request?

When trying to add a comment via Ajax, the site freezes (freezes) and the logs show a 503 error when sending /comment/add . before everything worked the problem in the server or in the code? please help

$(this).ajaxSubmit({
            url : baseUrl + 'comment/add',
            type : 'POST',
            dataType : 'json',
            success : function(data) {
                var json = data;
                if (json.status == 0) {
                    show_comment_add_error(form,json.message);
                } else {
                    div = $("<div style='display: none'></div>");
                    div.html(json.comment);
                    //commentList.append(div);
                    $(".comment-lists-" + form.data('type') + '-' + form.data('type-id')).each(function() {
                        $(this).append(json.comment);
                        //alert(".comment-lists-" + form.data('type') + '-' + form.data('type-id'))
                    });
                    $(".comment-count-"+form.data('type') + '-' + form.data('type-id')).each(function() {
                        $(this).html(json.count);
                    })
                    notifySuccess(json.message);

                    resent_comment_form(form);
                    reloadInits();
                }

                toogleCommentIndicator(form);
            },
            error : function() {
                toogleCommentIndicator(form);
            }
        });
        return false;
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Bobylev, 2017-11-26
@dpigo

From the section of code that you show, nothing is clear at all, because it already works with consequences. Therefore, there can be no problems in it, with the exception of the address at which the request is made.

  • Look at what address the appeal is going to in devtools.
  • Test the correctness of post-request processing with postman.
  • See what data goes there.
  • Turn on error debugging and see what's wrong on the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question