This is how I request data via ajax for html form with id 'formdata'.
I serialize the data from the form, and submit it via ajax to a raw view, and then i display the content of the raw view as plain text in a div with id 'myformoutput'
<script type="text/javascript">
function formupdate()
{
$.ajax({
type: "POST",
url: "index.php?option=com_mycomponent&view=outputview&format=raw",
data: $('#formdata').serialize(),
cache: false,
success: function(html) {
$('#myformoutput').html(html);
}
});
}
</script>
The raw view is from the component com_mycomponent, and the view name is 'outputview'.
'outputview' has the file view.raw.php instead of view.html.php. it contains:
class mycomponentViewoutputview extends JView
{
function display($tpl = null)
{
echo 'this is raw text';
}
}