I am having HTML file for user input and use REST API for update into SharePoint list. we have a requirement to get value from external API.
I am able run the below script from normal HTML form, and get the result
$(document).ready(function () {
$("#btn_getEmpID").click(function () {
// getUserInfo();
// alert("vg:test ->" + localStorage.getItem("submittedID"));
debugger;
$.ajax({
asynch: false,
url:"http://dummy.restapiexample.com/api/v1/employees",
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: function (data) {
debugger;
alert("test:SUCCESS");
},
error: function (x, y, z) {
debugger;
alert(JSON.stringify(x) + '\n' + JSON.stringify(y) + '\n' + JSON.stringify(z));
}
});
});
})
while using in SharePoint online, I am getting error.
What would be the best option to access the external API in SharePoint online page?
thanks GV

