I am trying to submit a form using jquery ajax in POST method. The action of the form is in another domain.
I have tried almost everything but getting the same error:
Failed to load http://localhost:3000/api/job-entry: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3400' is therefore not allowed access.
Here is what I tried:
$.ajax({
  type: 'POST',
  url: url,
  data: data,
  dataType: 'json',
  "crossDomain": true,
  contentType: 'application/x-www-form-urlencoded',
  // "headers": {
  // "accept": "application/json",
  //  "Access-Control-Allow-Origin": "*"
  // },
  xhrFields: { withCredentials: true },
  success: function(res) {
    func(res)
  },
  error: function(e, e2) {
    func({ e2: e2, e: e })
  }
});
I cannot use jsonp as it is POST method.
Is there any other way to submit a form in post method from one domain to another domain???
Actually, I am trying to create a mobile app in Cordova. So, there is no way of server-side request.
Any help will be appreciated
 
    