I am trying to load some JSON data from an URL to populate a dropdown in a form.
I am using the getJSON() function to get the data, and it has worked for other URLs very well, but for this instance I don't know why it doesn't return anything.
let primaryValue = $("#cr5dd_workrequirement option:selected").val();
if (primaryValue != null && primaryValue != ""){
$.getJSON("/workreq_results?id=" + primaryValue, function (data) {
console.log("data");
});
}
The link is working fine and it is correct. I just want to see if the data is loaded correctly from the URL. This is the data found at the link:
{ "results": [ { "DeptID": "cad426c1-eec7-ed11-b597-000d3aa9a09b", "DeptName": "HR ", } ] }
I am getting no error from the console and the dev tools are showing that the products file is being loaded! I am seeing a status of 200 OK. But there is no data returned in the console. What issue may it be?