【问题标题】:Joomla 3 Custom Module not able to get Data from AjaxJoomla 3 自定义模块无法从 Ajax 获取数据
【发布时间】:2017-07-31 10:55:22
【问题描述】:

您好,我正在尝试通过从我的 helper.php 调用函数来使用 ajax 设置输入字段的字段值,但它不返回任何内容。

这是我的 mod_name.php 文件

$doc = JFactory::getDocument();

$js = <<<JS
(function ($) {

   jQuery('#edit_sch').click(function() {
        var value   = 'cyannnnn',
            request = {
                    'option' : 'com_ajax',
                    'module' : 'helloworld',
                    'method' : 'sch',
                    'data'   : value,
                    'format' : 'raw'
                };

        jQuery.ajax({
            type   : 'POST',
            data   : request,

            success: function (response) {
                $('#edit_duration').val('dssd');
            }
        })
        return false;
    });

});(jQuery)
JS;

$doc->addScriptDeclaration($js);

这是我的 helper.php 文件

<?php

class ModVedhikaSchedule {
public function schAjax()
    {


        return 'Hello Ajax World' ;
    }
 }

【问题讨论】:

    标签: joomla3.0 joomla-extensions


    【解决方案1】:

    我认为您在 ajax 调用函数中缺少 url 参数。添加参数并再次检查。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-03
      • 1970-01-01
      • 1970-01-01
      • 2015-10-10
      相关资源
      最近更新 更多