A
A
Arseniy Sokolovsky2021-08-03 13:54:53
AJAX
Arseniy Sokolovsky, 2021-08-03 13:54:53

Ajax request is executed but fails?

I have an ajax request

$.ajax({
            url: localDancerweek,
            type: "POST",
            headers: {
                "mapname": songCodename,
                "type": "write",
                "nickname": "",
                "avatar": "",
                "score": ""
            },
            dataType: "json"
        }).done(function()  {
            alert("Success.");
        }).fail(function(xhr, status, error)  {
            alert("Sorry. Server unavailable. " );
            alert( [ xhr.status, status, error ] );
        });

On successful request, a json file is created
{"avatar":"","nickname":"","mapname":"365","score":""}

Well and so, at request, the file that is created. But for some reason it responds with fail, not done. The request seems to be successful. What could be wrong?
Mistake:6109218e0f191213942508.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ildar V, 2021-08-12
@ivaleyev

What form should the response take? Maybe you need to apply dataType to text, for example?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question