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 = \"
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.