I use spring boot in a rest architecture. I use jquery to call server url.
@PatchMapping(value = "/members/{memberId}/payments/{paymentsId}")
public boolean updatePaymentStatus(@PathVariable("memberId") Long memberId, @PathVariable("paymentsId") List<Long> paymentsId, @RequestParam("status") StatusEnum status) {
if (status == StatusEnum.CANCEL) {
paymentService.cancelPayments(paymentsId);
} else if (status == StatusEnum.REFUND) {
paymentService.refundPayments(memberId, paymentsId);
}
return true;
}
On the client side i try to call this url with this code
function paymentStatusAjaxCall(paymentsId, status) {
debugger;
var memberId = $('#memberId').val();
var type = "patch";
var url = getHostName() + "/members/" + memberId + "/payments/" + paymentsId;
jQuery.ajax({
type: type,
url: url,
data: {"status": status},
contentType: "application/json",
dataType: 'json',
headers: {
"Authorization": "Basic " + $.cookie('authorization')
},
success: function (data, status, jqXHR) {
var deferredPayment = loadMemberPaymentTable(templateMemberPayment, memberId);
$.when(deferredPayment).then(function () {
$("[data-localize]").localize("norc", {language: "fr", pathPrefix: "locales"});
});
},
error: function (jqXHR, status) {
checkError(jqXHR);
}
});
}
example of url
http://localhost:8080/members/1/payments/9,1
Server url is never join, on client side i get 404
if i do
http://localhost:8080/members/1/payments/9,1?status=CANCEL
that work