1

I am a beginner to REST web services and am building a client JavaScript library for my application which needs to do some AJAX calls to the server. Both are hosted on the same domain as to not cause any cross-domain problems in the case of Mozilla/Chrome. The server-side implementation needs to know the username and password (both embedded) of the GET request coming in, something like:

request.open(reqtype,url,async,username,pwd)

How can i do this in jQuery?

jquery.get()

$.ajax({
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

Is there any embedded option of sending username and password for the REST service in the request using $.get()?

2 Answers 2

1

Read the jQuery documentation for their AJAX API first, http://api.jquery.com/jQuery.ajax, http://api.jquery.com/jQuery.post and http://api.jquery.com/jQuery.get. For username and password do not do a GET as it will send them as querystring values. Do a POST.

Sign up to request clarification or add additional context in comments.

Comments

0

add them the the header property using the Authorization field.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.