Embeding the dhis2 map in javascript

var base = “example.com”;
Ext.onReady( function() {
url: base + “dhis-web-commons-security/login.json”,
method: “POST”,
params: { j_username: “my_username”, j_password: “my_password” },
crossDomain: true,
xhrFields : {
dataType : “jsonp”,
success: setLinks

function setLinks() {
DHIS.getMap({ url: base, el: “map1”, id: “VWJfOyWwhKm” });

Please I am trying to embed the map with the code above in my javascript with an existing map but I am getting this error below:
POST http://example.com/dhis-web-commons-security/login.json HTTP/1.1 401.

Can anyone help me on this error please? I am a beginner

Hey and welcome to the community @software_developer20 !
This clearly seems like an issue with authentication, and could be because of crossDomain issue. Have you read the “How to debug common development errors” guide? Please see if the instructions help solve the issue! How to debug common development errors | DHIS2 Developer Portal


I solved it by modifying the url to this: dhis-web-commons/security/login.action and I removed these parameters: crossDomain, xhrFields and dataType. However I am still getting an error which is telling that DHIS is not defined: Uncaught ReferenceError: DHIS is not defined

Here are my external dependencies: