Error AJAX Request - I cannot manipulate the return

Asked

Viewed 122 times

0

I have the following AJAX request:

function getJson(link) {
    var retorno;
    $.ajax({
        type: "POST",
        url: link,
        dataType: "json",
        async: false,
        success: function (data)
        {
            alert(data);
            retorno = data;
        }
    });
    return retorno;
}

When I run it shows a json in the Chrome Network tab. But nn I can manipulate using the date variable neither in an Alert nor in the return itself. There’s something wrong with the code?

Alert in the date variable

undefined

Aba Network

Network

I think the error ta aq:

"Failed to load: Response to preflight request doesn’t pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin '127.0.1.1'; is therefore not allowed access."

  • believe it is in the background language the problem, otherwise in Alert would have appeared [Object Object]

  • What is the schedule of this return?

  • I can’t say, I’ll file a requisition with Trivago.

  • Check in the Network tab, in the devtools of Chrome or firefox, just press F12, see what the request is returning.

  • In the Network tab appears the json that would be the return. But nn I can manipulate it through the date variable (defined in Success).

  • I think the error ta aq: "Failed to load: Response to preflight request doesn’t pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin '127.0.1.1'; is therefore not allowed access."

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.