This might be a silly question, but I try to do a post request with jquery and I don't know how to set my "url" in my post request.
I have a variable "id":
var url = window.location.pathname.split('/');
var id = url[3];
And I would like my post to go to /mysite/xxx/"id"/
here is my post request:
$.post("/mysite/xxx/'id'", {
name: "test"
});
I don't know how to do include the variable "id" at the end of my url. Thank you for your help.
P.S: this post request goes to the exact same url where I try to implement it. I don't know if there is a simpler way to do it than specify the whole url again.