Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Default ajax request method should be GET. Don't forget to send().
Browse files Browse the repository at this point in the history
  • Loading branch information
lance committed Nov 30, 2015
1 parent d079422 commit fbae9f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ribbon-webapp/runtime/src/main/resources/ribbon.js
Expand Up @@ -27,6 +27,8 @@ var ribbon = (function() {
// Set relevant headers
if (settings.method === 'POST') {
settings.headers['Content-Type'] = 'application/json';
} else if (!settings.method) {
settings.method = 'GET';
}

if (!keycloak) {
Expand Down Expand Up @@ -70,7 +72,8 @@ var ribbon = (function() {
// set the state change handler and make the http request
request.onreadystatechange = changeState(request, deferredResponse);
request.open(settings.method, settings.url);
request.send(settings.data);
if (settings.data) request.send(settings.data);
else request.send();

// return a deferred promise
return deferredResponse;
Expand Down Expand Up @@ -118,6 +121,7 @@ var ribbon = (function() {

function getJSON(serviceName, path, data) {
return ajax( serviceName, path, {
method: 'GET',
data: data
});
}
Expand Down

0 comments on commit fbae9f6

Please sign in to comment.