Vor Kurzem aufgerufene Suchen


Keine vor kurzem aufgerufene Suchen

CORS error after successfully creating ticket



Gepostet 09. Sept. 2022

I'm having an issue with returning a response after creating a ticket. Note, the ticket gets created in Zendesk, so everything works except returning a response back to the browser. Here's my code:

const request = await fetch("https://{obscured}.zendesk.com/api/v2/tickets", {
    method: "POST",
    headers: {
        "Authorization": "Basic "+wp_helper.zendesk_token,
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
        "ticket": {
            "comment": {
                "body": comment,
                "uploads": [
                    file_token
                ]
            },
            "requester": { "locale_id": 1, "name": full_name, "email": email },
            "subject": subject
        }
    })
});
let response = await request.json();
console.log(response);

These are the errors I'm getting in the browser console after the ticket is successfully created:

Tag: Eric Nelson


0

1

1 Kommentar

image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Luke,

This is expected behavior, I'd suggest reading our article on working with cross origin requests here.

Thanks

0


Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Sie finden nicht, wonach Sie suchen?

Neuer Post