javascript - How to automatically enter the username in a popup window, ajax? -
i have code gets url, however, site requires username enter. pops pop-up window. - https://jsfiddle.net/221ztatv/
$.ajax({ type: 'get', url: 'http://www.reed.co.uk/api/1.0/search?keywords=imobilus%20jobs', data: { username: 'b110030d-7491-48fe-9354-05c0ec0181d7', password:'' },
however, want automatically fill-in username , password , submit it, possible?
the same techniques outlined in this discussion on stack overflow can used.
either use jquery's username
, password
attributes, or below, $.ajax
.
beforesend: function(xhr) { xhr.setrequestheader("authorization", "basic " + btoa(username + ":" + password)); };
bearing in mind username/password can read users. if site authenticated, or firewalled/secured internally, that's better, or can reason - e.g., api prohibit server-side authentication. luck.
Comments
Post a Comment