0

I was trying to send a post request to a url like below

(function($) {
  $(document).ready(function() {
    var end_point_url = "https://xxxxxx.freshdesk.com/api/v2/tickets";
    // Create a ticket
    jQuery.ajax({
      url: end_point_url,
      dataType:"json",
      data: {
          subject: "Test ticket by shiva one",
          description: "Details about the issue... one",
          email: "shiva1@xxxxxx.com",
          priority: 1, 
          status: 2, 
          cc_emails: ["ram@freshdesk.com","diana@freshdesk.com"]
      },
      type: 'POST',
      success: function(data) {
        debugger
      }

    });

  });
})(jQuery);

Error:

    Uncaught TypeError: Cannot set property '$container' of undefined
        at HTMLDocument.<anonymous> (common-0.4.0.min.js:1)
        at HTMLDocument.dispatch (frameworks-39b5690….js:26)
        at HTMLDocument.g.handle (frameworks-39b5690….js:25)
        at Object.trigger (frameworks-39b5690….js:26)
        at Object.e.event.trigger (frameworks-39b5690….js:31)
        at HTMLDocument.<anonymous> (frameworks-39b5690….js:26)
        at Function.each (frameworks-39b5690….js:15)
        at e.fn.init.each (frameworks-39b5690….js:15)
        at e.fn.init.trigger (frameworks-39b5690….js:26)
        at <anonymous>:16:28
    (anonymous) @ common-0.4.0.min.js:1
    dispatch @ frameworks-39b5690….js:26
    g.handle @ frameworks-39b5690….js:25
    trigger @ frameworks-39b5690….js:26
    e.event.trigger @ frameworks-39b5690….js:31
    (anonymous) @ frameworks-39b5690….js:26
    each @ frameworks-39b5690….js:15
    each @ frameworks-39b5690….js:15
    trigger @ frameworks-39b5690….js:26
    (anonymous) @ VM3153:16
    dispatch @ frameworks-39b5690….js:26
    g.handle @ frameworks-39b5690….js:25
    frameworks-39b5690….js:27 POST https://xxxxxxxxx.freshdesk.com/api/v2/tickets 415 (Unsupported Media Type)

What's going wrong in the above code ? i am just trying to send a POST request

4

0 回答 0