How to send parameters with jquery $.get() How to send parameters with jquery $.get() ajax ajax

How to send parameters with jquery $.get()


If you say that it works with accessing directly manageproducts.do?option=1 in the browser then it should work with:

$.get('manageproducts.do', { option: '1' }, function(data) {    ...});

as it would send the same GET request.


Try this:

$.ajax({    type: 'get',    url: 'manageproducts.do',    data: 'option=1',    success: function(data) {        availableProductNames = data.split(",");        alert(availableProductNames);    }});

Also You have a few errors in your sample code, not sure if that was causing the error or it was just a typo upon entering the question.


I got this working : -

$.get('api.php', 'client=mikescafe', function(data) {...});

It sends via get the string ?client=mikescafethen collect this variable in api.php, and use it in your mysql statement.