Reputation: 3512
How to use JQuery to call a servlet which I usually call like this http://localhost:8080?a=1&b=2&c=3. I particularly want to find out how to pass URL params.
Upvotes: 0
Views: 5884
Reputation: 47913
$.ajax({
url: 'http://localhost:8080',
data: {a: 1, b: 2, c: 3},
success: function(response) {
}
});
Upvotes: 4
Reputation: 9709
Earlier today I wrote up a detailed explanation of using the jquery $.post()
to interact with php. The jquery side will be exactly the same for a servlet; only the address will differ.
If you'd rather use a get request, or return data that is not in the format of either JSON or a string, you can get info about the different methods possible from the jQuery API.
Upvotes: 1