tags:

views:

17

answers:

1
function decreased(param) {
   console.log(param);
     $.ajax({
 type: "GET",
 url: "scripts/closed.php",
 data: "name=" + param,
 success: console.log('success'),
          });
    }

I don't know why my function isn't working. The path is correct the param is correct if i type in closed.php?name=param the script there works and in the end after calling the function i get the console log success printed, i really don't understand.

+3  A: 

The problem is with your success handler. It should be like this:

$.ajax({
    type: "GET",
    url: "scripts/closed.php",
    data: { name: param },
    success: function(data) {
        console.log('success');
    }
});

Also notice the usage of a hash for the data parameter which allows to properly URL encode values.

Darin Dimitrov
thank you, it worked. i better do some more reading on the ajax function :(
andrei