Skip to content

Commit

Permalink
Merge pull request #1 from nicoschoenteich/main
Browse files Browse the repository at this point in the history
fix: ajax request
  • Loading branch information
kevindass committed Dec 2, 2022
2 parents 9edf1dd + c1d59ed commit 4aaf848
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion webapp/controller/View1.controller.js
Expand Up @@ -9,13 +9,23 @@ sap.ui.define([

return Controller.extend("reqres.controller.View1", {
onInit: function () {

let myPathWithoutFile
if (window.location.href.indexOf("localhost") == -1) {
const myPath = window.location.pathname
myPathWithoutFile = myPath.substring(0, myPath.lastIndexOf('/'))
console.log(myPathWithoutFile)
} else {
myPathWithoutFile = ""
}

var that = this;
var oEntry = {};
// GET
var aData = jQuery.ajax({
type: "GET",
contentType: "application/json",
url: "/api/users?page=2",
url: myPathWithoutFile + "/api/users?page=2",
dataType: "json",
async: false,
success: function (data, textStatus, jqXHR) {
Expand Down

0 comments on commit 4aaf848

Please sign in to comment.