简体   繁体   English

Joomla中的jQuery AJAX响应

[英]jQuery AJAX response in Joomla

I am working on joomla. 我在做joomla。 I use the json code, ie 我使用json代码,即

<script language="JavaScript1.2">
    jQuery.noConflict();
    jQuery(function() {
        jQuery('.text_area').change(function() {
            var traID = jQuery(this).val();
            jQuery.getJSON('?option=com_propertyform&view=ajaxdata&format=raw', {
                traid: traID
            }, function(response) {
                if (response) {
                    console.log(jsonData);
                }
            });
        });
    });
</script>

but there is a response error "500 Internal Server Error 71 ms". 但是出现响应错误“ 500 Internal Server Error 71 ms”。 I create a view that is ajaxdata. 我创建了一个ajaxdata视图。 So anybody help me how to get response from that page. 因此,有人可以帮助我如何从该页面获得回复。

your url is not correct. 您的网址不正确。

If your file is external, change the getJSON to 如果您的文件是外部文件,请将getJSON更改为

jQuery.getJSON('index.php?option=com_propertyform&view=ajaxdata&format=raw', {...});

However, if your JavaScript is generated by PHP, do it like this 但是,如果您的JavaScript是由PHP生成的,请按照以下方式进行操作

 jQuery.getJSON('<?php echo JRoute::_('index.php?option=com_propertyform&view=ajaxdata&format=raw'); ?>', {...});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM