Rectangle 27 0

python What format is a jQuery ajax post request sending the data in and how can it be accessed through Flask's request object?


$.ajax({
  type: 'POST',
  url: 'http://myurl.com/create',
  crossDomain: true,
  data: '{'title': sender.title, 'url': sender.url}',
  dataType: 'jsonp',
  success: function(responseData, textStatus, jqXHR) {
    // Success Callback
  },
  error: function (responseData, textStatus, errorThrown) {
    // Error Callback
  }
});

The problem is that your Ajax request is not configured to target cross domain requests. I suggest the use of $.ajax instead of $.post for more flexibility and to set crossDomain: true in your request configuration.

setting cross-domain to true alone doesn't make cross-domain requests work. In the documentation, that option is for making a same domain request perform as if it were cross-domain, for example, a same-domain jsonp request. Since it is a cross-domain request, it already is true.

Note
Rectangle 27 0

python What format is a jQuery ajax post request sending the data in and how can it be accessed through Flask's request object?


Note
Rectangle 27 0

python What format is a jQuery ajax post request sending the data in and how can it be accessed through Flask's request object?


Note
Rectangle 27 0

python What format is a jQuery ajax post request sending the data in and how can it be accessed through Flask's request object?


$.ajax({
  type: 'POST',
  url: 'http://myurl.com/create',
  crossDomain: true,
  data: '{'title': sender.title, 'url': sender.url}',
  dataType: 'jsonp',
  success: function(responseData, textStatus, jqXHR) {
    // Success Callback
  },
  error: function (responseData, textStatus, errorThrown) {
    // Error Callback
  }
});

The problem is that your Ajax request is not configured to target cross domain requests. I suggest the use of $.ajax instead of $.post for more flexibility and to set crossDomain: true in your request configuration.

setting cross-domain to true alone doesn't make cross-domain requests work. In the documentation, that option is for making a same domain request perform as if it were cross-domain, for example, a same-domain jsonp request. Since it is a cross-domain request, it already is true.

Note