When I add alert('now it works'); this function works but I don't want this

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() {         
        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.

Browse More Popular Posts

Leave a Comment