You might read the value of the input field by using a jQuery’s ID selector for the field.
Then simply append the value to the URL.
It’s a GET request.
function a() {
$.ajax({
type: 'GET',
url: 'z.php?ac=" + $("#myInputfield").val(),
success: function(data){
console.log("it works. data: ' + data);
}
});
}
This is not the best way to do this: please look into jQuery Ajax Post & Form Serialization.
Instead of alert() you might use console.log(). Alert might block the Ajax execution.