简体   繁体   中英

jQuery AJAX response in Joomla

I am working on joomla. I use the json code, ie

<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". I create a view that is 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

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

However, if your JavaScript is generated by PHP, do it like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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