I am creating a module where i want to get database value from ajax. anybody have a solution of this problem or any example please help me... can anyone give me a proper way for this.......
this is my jquery
code-
jQuery('.type').bind('click', function() {
var feedId = jQuery(this).attr('id');
alert(feedId);
jQuery.ajax({
type: "POST",
url: "modules/mod_feedback/ajax.php",
data: {"Type":feedId},
success: function(reviews){
//jQuery(".show").html(response);
alert(reviews);
}
});
});
and this is my ajax.php
code-
require_once( 'helper.php' );
$reviews = modfeedbackHelper::getFeedbackResultIdea();
echo $reviews;
Here is the ajax Call.
and in ajax.php
That should do :):)
First of all you're trying to make an ajax call to the files inside module and its not a part of the module, so it act like external php file
modules/mod_feedback/ajax.php
is wrong. You have to make the ajax call to the related component controller like below.Then inside your controller file a function named with
your_function
and have the following codes inside your function
Then it will work otherwise you have to load Joomla frame work to your ajax.php its a bad idea. try to follow correct methods.
Hope its helps..