Hi i want to convert this cmd curl to JQuery Ajax Post :
curl -k -X POST https://openshift.redhat.com/broker/rest/domains/MyDomain/applications
--user "user@myemail.com:password"
--data "name=myapp&cartridge=php-5.3&scale=true"
thats what i do :
jQuery.ajax({
url: 'https://openshift.redhat.com/broker/rest/domains/MyDomain/applications ',
username: 'user@myemail.com',
password: 'password',
type: 'POST',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: 'name=myapp&cartridge=php-5.3&scale=true"',
success: function (data) {
alert(JSON.stringify(data));
},
error: function(xhr, status, error) {
alert("(" + xhr.responseText + ")");
}
});
and i get this error after submitting in my alerte :
(<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /https://openshift.redhat.com/broker/rest/domains/MyDomain/applications was not found on this server.</p>
<hr>
<address>Apache/2.4.6 (Fedora) Server at drupal-pcsol.openshift.local Port 80</address>
</body></html>
)
Any ideas please ?
AFAICS, this is a cross domain request, which is not allowed in Ajax.
Learn more: Same-origin policy