I have a javascript file in which i want to send json data to a ERP system:
var formData1 = JSON.stringify($('#msform').serializeObject());
$.ajax({
url:'http://102.101.101.11:80/c/orders',
type:'POST',
data:formData1,
crossDomain: true,
dataType: 'json',
jsonpCallback: 'callback',
success: function(data) {
//window.location.href = "http://www.petlooza.com";
console.log(data);
}
});
This script works with chrome and IE, but FIREFOX gives me this error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. Reason: Cors-request failed.
How to fix this? See solution below!