connecting one instance to another instance from Java Script to Angular

0

I have two applications:
1. basic web.xml based servlet application running on instance X web server 1 - http://localhost:8080/Route.Js

  1. Angular based application also running on the same instance X web server 2 - http://localhost:4200/Primary

So from the application 1, Js file we need decision-making process to send/redirect to angular application. I have tried the following options.

Option1:

var xhr = new XMLHttpRequest();
 xhr.open("GET", "http://localhost:4200/Primary", true);
 xhr.withCredentials = true;
 xhr.send();

Option 2:

  jQuery.ajax({
            url : "http://localhost:4200/Primary",
            type : "POST",
            cache : false,
            async : false,
            success : function(data, textStatus, jqXHR)
            {
                alert("sucess..");

            },

            error : function(jqXHR, textStatus, errorThrown)
            {

                alert("failure..");
            }
        });

Option2 throws following error:
XMLHttpRequest: Network Error 0x80070005, Access is denied.

I tried lot on online but now sure how to solve this issue? Thanks in advance

java
angularjs
spring
tomcat
deployment
asked on Stack Overflow May 10, 2019 by Will Mcavoy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0