I am trying to submit my form using jQuery ajax, but my data isn\'t posting to PHP it returns empty array nothing in $_POST array.
This is my code - here i
The form action needs to be either absolute url i.e. https://somewebsite.com or a relative url on you site so ideally it should be /some-url.php. Read about form action here
So your form opening tag should be,
So in your javascript code when you do
var url = $(this).attr("action");
I also believe that in your ajax call, the type needs to be method, so,
$.ajax({
method: "POST",
.....
})