views:

33

answers:

1

Hello,

I am working on joomla. i use the json code i.e.

<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 response error "500 Internal Server Error 71 ms". I create view that is ajaxdata. So anybody help me how to get response from that page.

A: 

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'); ?>', {...});
Alex
Hello Alex, Still there is internal server problem if i include the index.php before the "?".
Dev D
Alex
Hi I tried your second answer its working but response from server side is blank when i see it in firebug. I create ajaxdata in views and write the query in raw file....
Dev D
are you getting any response if you request the data directly? Do you have `view.raw.php` in your view directory? Most likely you have some condition in your raw that is exiting/results empty output. Just a side note: I usually name my views depending on the type of output, `view.html.php` - for HTML output, `view.raw.php` - for text response, `view.json.php` - for JSON response, `view.xml.php` - for xml. This way things are easier to maintain.
Alex