Solved

Custom feedback AJAX submission

Hello  I am having an issue with using AJAX to submit a custom feedback page from my website.  Here's what I have

  

$.ajax({
    beforeSend: function (xhr) { 
        xhr.setRequestHeader('Authorization', 'APIkey:' + btoa('XXXXXXXX'));
    }, 
    type: "POST",
    contentType: "application/jsonp; charset=utf-8",
    url: 'http://f4.freshdesk.com/helpdesk/tickets.json',
    data: { 
        "helpdesk_ticket":{
          "description":"Some details on the issue ...",
          "subject":"Support needed..",
          "email":"hulk@outerspace.com",
          "priority":1, "status":2
      }
    },
    processData: false,
    dataType: "jsonp",
    crossDomain: true,
    error: function (xhr, ajaxOptions, thrownError) {
        console.log(thrownError);
    }
});

 I get an error message ""jQueryXXXXXXXXXXXXXXXXXXXXXXX was not called"  Anyone know how to resolve this issue?   


1 person has this problem
1 Comment

Hello I tested your code, because i am trying to do the same. Create a new ticket in my freshdesk, from my website.

But, the Freshdesk does not allow us do it. You have to read about CORS to understand.


I am trying to do it, but without progress.


In your code you can change


...

contentType: "application/jsonp; charset=utf-8", to contentType: "application/json; charset=utf-8",

...

dataType: "jsonp", to dataType: "json"

...

because you have to use JSON and no JSONP cause they dont have support to it.

And you will got the CORS error.


If you in this time make this code WORKS, please tell me HOW. Or, we can work togetter in our solutions :D


Thank you.