Hello again,
Thank you very much for such helpful reply.
I tested the script on other basic authentication end point and its working fine.
and the good news is now I am able to login at commcare server using script but unable to fetch the data, getting an error by browser
Cross-Origin
Request Blocked: The Same Origin Policy disallows reading the remote
resource at https://apps.dhis2.org/demo/api/validationRuleGroups. This
can be fixed by moving the resource to the same domain or enabling CORS.To resolve above error I did some search on Google and found out two solutions
(1) Use data type in ajax request as
jsonp to get response. (with this setting I am getting null data in Objects list)
(2) Server side configuration for cross domain access. I think possibly at server side no configuration has done for cross domain access. (
http://www.html5rocks.com/en/tutorials/cors/#toc-making-a-cors-reques ).
http://stackoverflow.com/questions/9559947/cross-origin-authorization-header-with-jquery-ajaxPlease verify that Is commcare server provide
JSONP services? if not then Is it configured to provide cross-domain access.
any help or suggestion would be much appreciated.
Thanks.