Using ajax to make a curl request

前端 未结 3 370
逝去的感伤
逝去的感伤 2021-01-25 05:51

This answer has helped me largely but hasn\'t fully resolved my issues. I\'m using code similar to that, which is:

function getResponse() {

    var the_url = \"         


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-25 06:26

    Update your jquery ajax call to include the username and passward options for HTTP authentication, see the Advanced options in the documentation:

    If the server performs HTTP authentication before providing a response,
    the user name and password pair can be sent via the username 
    and password options.
    

    Update as pointed out in the comments, HTTP authentication simply doesn't work with JSONP, as the questioner used (didn't see that, my bad). I'll leave this answer here anyway for other people to find that don't use JSONP.

提交回复
热议问题