I want to run a Jenkis job that requires login from a web page (outside of jenkins) using ajax currenly i have to have another browser tab with jenkins open (and authenticated) in order for the job to run from my web page
iv'e tried different approaches to sending the authentication info with ajax this is what i currently have:
$.ajax({
type: "POST",
url: "http://myjenkins/job/job_name/buildWithParameters",
dataType: 'jsonp',
data: $("#myForm").serialize(),
beforeSend: function(xhr){
xhr.setRequestHeader("Authorization", "username:password");
},
success: function(data) {
},
complete: function(xhr, statusText){
}
});
(there's some more HTML code that receives parameters from a form) if i have an open tab with jenkins authenticated this runs fine, but if i don't i get a "430 forbidden" responce from jenkins.
the "xhr.setRequestHeader("Authorization", "username:password");" is just my latest attempt...
any input is welcome!