If required as mentioned by others you CAN connect using SOAP (probably not recommended but as you want to know). If you don't know how to use SOAP/JavaScript then I suggest you read this:
Simplest SOAP example
To connect to CRM Online using Office 365 (all Windows Live accounts are migrating to Office 365) then you need to get security tokens then use that for your requests.
The following is a request for tokens in PHP that you should be able to refactor for JavaScript.
$TokenSOAP = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:MessageID>urn:uuid:%s</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">%s</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>%sZ</u:Created>
<u:Expires>%sZ</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-cdb639e6-f9b0-4c01-b454-0fe244de73af-1">
<o:Username>%s</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%s</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<a:EndpointReference>
<a:Address>urn:crmapac:dynamics.com</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
</t:RequestSecurityToken>
</s:Body>
</s:Envelope>';
$TokenSOAP = sprintf($TokenSOAP, self::gen_uuid(), 'https://login.microsoftonline.com/RST2.srf', self::getCurrentTime(), self::getNextDayTime(), $username, $password);
Change the Endpoint Reference address as required depending on your crm region
This will return two security tokens and a key identifier.
Then you need to do your add and retrieve. If you google "CRM 2011 SOAP" and the following four functions "Create", "Update", "Retrieve", and "RetrieveMultiple" you should get lots of SOAP samples for example:
http://www.mscrmconsultant.com/2012/07/create-update-delete-record-using.html