I am trying to produce a module in joomla, which utilizes one jquery wordpress plugin. I have to complete an ajax operation while hitting a component within the module. Presently I am indicating the entire road to the php file. However I know Its an incorrect method.

The code in jquery wordpress plugin is much like this.(please be aware the 2nd line in which the path is specified by the jquery wordpress plugin file)

       $.get(
            "/subdirectory/MyBlog/modules/mod_calendar/getCalendar.php", {
                month: $("#selectedMonth").val(),
                year: $("#selectedYear").val(),
                flag: '-1'
            }, function(data){
                $("#monthlyCalendar").html(data);
                $("#monthlyCalendar").show();
            }
        ); 

What's the correct approach to specify the road inside a jquery wordpress plugin file. Also I have to know where you can put my jquery wordpress plugin file within the module.

I discovered a solution within the following blog.

http://blog.subooa.com/development/joomla-coding/ajax-in-joomla-with-jquery/

The easiest way I discovered to get it done is by using the JURI::root method to produce a javascript variable will be able to then use. Inside your php code, you'd make a move such as this:

?>

<script type="text/javascript">
        var joomlaRoot = '<?php echo JURI::root(); ?>';
</script>

<?php

After that you can use that variable when doing your AJAX call.

For where you can place the jquery wordpress plugin file inside your module, place the it whereever you would like beneath your module's directory after which use JURI::root again to produce a road to it and call the JDocument::addScript method.

On the side note, you might think about using MooTools. It comes down bundled up in Joomla! already. It is able to do AJAX calls. Also, from it, you avoid the potential of getting jQuery conflicts.

Atlast I found a great choice to make use of the Ajax using Jquery in Joomla.

With this first, produce a view and model to obtain the needed html through Ajax call.

Then use jQuery code like the following to obtain just the creation of the needed view.

//Code to get the base URL of joomla installation
szURL = document.URL;
componentList = szURL.split('/');
szDocument = componentList[componentList.length-1];
szURL = szURL.replace(szDocument, "");

//URL to the required component
url = szURL + "?option=COMPONENT_NAME&view=VIEW_NAME&tmpl=component&uid=" + getRandomValue();
jQuery.get(url, function(data) {
    jQuery("#mydiv").html(data);
});


//Function to get a random number
//It is used for Ajax calls from IE; Else IE will use the cache values
function getRandomValue(){
    return Math.floor(1000000 * (Math.random() % 1))
}

Note the URL employed for the ajax call. It uses "tmpl=component" to obtain just the html for that selected component without joomla HTMLs.