0
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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.