This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I'm modifying the OctoCase plugin and I'm wanting to add some ajax functionality to it.
I've added an AJAX handler to the components\Items.php
public function onPortfolioItemClick()
{
$this['result'] = "This is the result";
}
I've added the Items component to a page as following:
{% component 'octocaseItems' %}
Below I added a little test using the AJAX Data attributes API:
<form data-request="octocaseItems::onPortfolioItemClick" data-request-update="ajaxResult: '#result'">
<input type="submit" value="Calculate">
</form>
<div id="#result"></div>
ajaxResult
partial is as simple as This is the result: {{ result }}
But when I click the submit button, I see the ajax loading bar on top but then a dialog appears saying:
Cannot use object of type \OctoDevel\OctoCase\Components\Items as array
What am I missing?
maybe you should try to convert it to array?
$items = Items::all(); return $items->toArray();
http://laravel.com/docs/4.2/eloquent#converting-to-arrays-or-json
1-3 of 3