Set fallback URL for instance pricing

Both URLs for kilo and newer Horizon versions are now supported.

Change-Id: I37abd2256292c7f9e96ea4c3bd3755438fe4a19b
This commit is contained in:
Stéphane Albert 2016-03-02 15:56:37 +01:00
parent 9ca6e2fed5
commit 25302991c2
1 changed files with 9 additions and 2 deletions

View File

@ -81,21 +81,28 @@ pricing = {
var form_data = [{"service": "compute", "desc": desc_form, "volume": instance_count}];
// send the JSON by a POST request
var url_data = '/dashboard/project/rating/quote';
var url_data = [
'/dashboard/project/rating/quote',
'/project/rating/quote']
this.sendPost(form_data, url_data);
}
},
sendPost: function(form_data, url_data) {
var url = url_data.shift();
$.ajax({
type: "post", // send POST data
url: url_data,
url: url,
dataType: 'json',
data: JSON.stringify(form_data), // data sent
contentType: 'application/json; charset=utf-8',
success: function (data) {
$("#price").text(data);
},
error: function () {
if (url_data)
pricing.sendPost(form_data, url_data);
},
beforeSend: function(xhr, settings){
$.ajaxSettings.beforeSend(xhr, settings);
}