I have the below script and I want to add username and password to be able to query confluence:
<script type="text/javascript">
$.ajaxSetup ({
cache: false
});
$(function() {
$("#submit").click(function() {
var request = $.ajax({
type: "POST",
data: JSON.stringify(
{"jsonrpc" : "2.0", "method" : "getSpaces", "params" : [], "id": 12345 }
),
//Please change <confluence-url> to the relevant url
url: "rpc/json-rpc/confluenceservice-v2",
async: false,
cache: false,
contentType: "application/json",
success: function() {
//alert("success");
}
});
$("#output").html(JSON.stringify(request));
return false;
});
});
</script>
Kindly advice