How to call pages by Ajax using javascript I've a created an Ajax-callback page using my module available as myModule/somepage/%/% - you can see that last two arguments in this page changes dynamically.

I want to make an AJAX call to this page, writing javascript. Say, when I click a button an ajax call will be made to this page (POST method preferably for the two arguments).

I know how to create hyper-links that handle Ajax calls automatically, but in that way links are static, and I can not send arguments to my Ajax-callback page. So how do I write JavaScript to make an Ajax call to my page?
Here is the code to make POST req to a webpage.

$('#yourid').click(function(e) {
    e.preventDefault();
    var theUrl = base_url + 'myModule/somepage';
    $.ajax({
        url: theUrl,
        type: "POST",
        data: "name=John&amp;location=Boston"
        success: function(msg){
        alert(msg);
        $('#displydiv').html(msg);
    }
    });
});