I need to retrieve data from a RESTful webservice using jquery

advertisements

i'm new to this RESTful webservice stuff so i'm asking if you can help me with this one.

I need to retrieve data from a restful webservice using jquery. now i know that i can do that using $.ajax or $.getJSON but the question is how can i do it if my restful webservice needs to enter username and password inorder to retrieve the data. Thank you


It depends on how your web service does authentication.

If it's token-based (via cookies or whatever), you'll need to invoke the login method of your service, get the token (or cookie, etc), and send that token with your future requests.

Other methods require other adjustments; authentication headers, etc. We can't tell you what you need unless we know what authentication method the service uses.