I am using AJAX to call my REST API in Azure which is an ML model deployed. I am getting one input string from a text field and on a button click I have written the following code:
I've tried sending a GET request, post request but not getting the success. `
  $.ajax({
        url: url,
        type: `POST`,
        data: JSON.stringify(InputDataText),
        contentType: `application/json`,
        headers: {
            "Authorization": `Bearer ${apiKey}`,
            "Content-Type": "application/json"
        },
        success: (response) => {
            console.log(response)
        },
       error: function(xhr, error, errorstring){
            console.log(error);
        }, 
        complete: (jqXHR, textStatus) => {
            console.log(`ajax completed: jqXHR: ${JSON.stringify(jqXHR)}, textStatus: ${textStatus}`)
        }
    });
The JSON data I am using:
 {
        "Inputs": {
            "input1":
                [
                    {
                        'Name': "AR",
                    },
                    {
                        'Name': "SAS is a bitch",
                    }
                ],
        },
        "GlobalParameters": {}
    }
The output I get with this JSON data on POSTMAN:
{
    "Results": {
        "output1": [
            {
                "Scored Labels": "Aortic Regurgitation"
            },
            {
                "Scored Labels": "Aortic Valve Stenosis"
            }
        ]
    }
}
` I want the success case to run but it always runs the error and complete case. The output is as follows:
ajax completed: jqXHR:
`
{"readyState":0,"status":0,"statusText":"error"}, textStatus: error
`
