I have a rest call,where it requires one parameter empid to be passed of type
application/x-www-form-urlencoded
Iam trying to consume that using the following code.But the value is getting passed as undefined to the restcall
function searchEmployee(employeeid){
var empEndpoint = 'http://localhost:3001/searchemp';
var http = new XMLHttpRequest();
http.open('POST',empEndpoint,true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
var empid = employeeid;
http.send(empid) ;
}
Please can someone point out the mistake and help me how to POST that in proper format.
via user7350714

No comments:
Post a Comment