I am unable to call FHIR GET and POST for creating and retrieving patient from my HTML page but it works with FHIR client in Open MRS

I am trying to retrieve a patient with old identifier number 1003 in my OPEN MRS, It works well when I do it with rest client just using GET and URL as http://localhost:8080/openmrs/ws/fhir/Patient?identifier=1003.

But when I try to communicate from my index.html page by AJAX request it returns an error 400. Can someone help please.

my AJAX request is shown below,

function getpatient(){ $.ajax({ url: “http://localhost:8080/openmrs/ws/fhir/Patient?identifier=1003”, type: “GET”, dataType: “json+fhir”, headers: { “Authorization”: "Basic " + btoa(“admin” + “:” + “Admin123”) }, success: function (result) { var myJSON = JSON.stringify(result); console.log(myJSON); alert(myJSON); } });

The error also says “Response for preflight has invalid HTTP status code 400”

{ “resourceType”: “OperationOutcome”, “issue”: [ { “severity”: “error”, “code”: “processing”, “diagnostics”: “Invalid request: The FHIR endpoint on this server does not know how to handle OPTIONS operation[Patient] with parameters [[identifier]]” } ] }

Did you figure this out?

i have the same issue can you help me please !