0

I am using Html with JavaScript to execute the jobs in the server. Below code working fine in local desktop, but when I move this same code to remote desktop. Here I am getting 403 forbidden error.

Error - Failed to load https://FRQMAAK834:4993/api/login/ntml: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. origin 'null' is therefore not allowed access.

Need your suggestion.

<html>
<head>
</head>
<body>
    <h1>Nprinting API task starter</h1>
        <script src="jquery-1.10.1.min.js"></script>
        <script type="text/javascript">
        (function()
            {
                console.log("started")
                var taskIDs=
                    [
                        "28b17059-3f0d-4844-83aa-0c0460f413bf"
                    ]
                var serverName=
                    [
                        "FRQMAAK834"
                    ]

                $.ajax({
                url: 'httpS://'+serverName+':4993/api/v1/login/ntlm',
                xhrFields: {
                withCredentials: true
                }
                }).done(function(data) {
                console.log(data);

                for(var i=0;i<taskIDs.length;i++)
                    {

                        $.ajax
                        ({
                        type: "POST",
                        url: 'httpS://'+serverName+':4993/api/v1/tasks/'+taskIDs[i]+'/executions',
                        xhrFields: 
                            {
                                withCredentials: true
                            }
                        }).done
                            (function(data) 
                                {
                                    console.log("task "+i);
                                    console.log(data);


                                }
                            );
                    }
                });
            })();
        <!-- open(location, '_self').close(); --> 
    </script>
</body>

Jim Jones
  • 18,404
  • 3
  • 35
  • 44
Venki
  • 57
  • 2
  • 8
  • `var serverName = ["FRQMAAK834"]` should be `var serverName = "FRQMAAK834"`. Or get it using `serverName[0]` – Red Apr 18 '18 at 08:40
  • Red, I have made the changes based on your suggestion, But no luck. still i am getting the same error. var serverName = "FRQMAAK834" – Venki Apr 18 '18 at 09:10

0 Answers0