Using Javascript to send an HTTP request for a service/resource