I am new to JavaScript. I'm creating my module. I'm trying to send data from an html form. I Can not use com_ajax...I create new class in helper.php
.
public static function getAjax() {
jimport('joomla.application.module.helper');
$input = JFactory::getApplication()->input;
$module = JModuleHelper::getModule('mymodulename');
$params = new JRegistry();
$params->loadString($module->params);
}
I need to send data to default.php
.
I wrote a script to send data to a mod_name.php
.
JS HERE:
<script>
jQuery.noConflict();
function function1() {
var data = jQuery("lol").serialize();
jQuery.ajax({
url: "index.php?option=com_ajax&module=auction&method=post&format=json",
type: "POST",
data: data,
success: function(data){
alert(data);
}
});
};
</script>
FOR
<form method="post" action="this.form.submit();" name="form1" id="lol">
<input type="text" name="price" onclick="function1();">
</form>
Did I do the right thing? And how can I get data in default.php
?
getAjax
. The method in the URL needs to be the function name but withoutAjax
, so in your case, it should bemethod=get