Uncaught TypeError: Cannot set property '$container' of undefined

425
January 30, 2017, at 00:03 AM

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

READ ALSO
Get value of repeated upload button in the right field

Get value of repeated upload button in the right field

With the help of other stackoverflow questions+answers I was able to create a WordPress post metabox with repeated media upload fields

325
How to get the index of which element we clicked on

How to get the index of which element we clicked on

I have a list of containers and I want to add a button that display a terminal on the container where we clicked on the terminal logo

322
Can&#39;t get data with Handlebars from JSON

Can't get data with Handlebars from JSON

Here is fiddle with code: jsfiddle

340