javascript - Using XMLHttpRequest with username and password -


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>     <head>        <script>         jquery.noconflict();          jquery(document).ready(function() {                    alert("hello world, part 2!");               callotherdomain();                    });       function callotherdomain() {          var invocation = new xmlhttprequest();         var username = "testuser";         var password = "testpass";         var url = 'http://someurl';           invocation.withcredentials = true;         invocation.open('get', url, true);                                           invocation.send();     }       </script>     </head> 

i need pass username , password access link. not sure how it. glad if here can help!

the same doing using ajax, need use xhttprequest implement cors.

    function getcontacts () {       jquery.ajax({          type: "get",          url: "http://some",          contenttype: "application/json; charset=utf-8",          datatype: "json",          username : "some",          password : "some",           success: function() { alert('get completed'); }     });     } 


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -