I am using ExpressionEngine (2.4) with the Solspace Calendar add-on. I have been following the tutorials here for reference:
Part 2: http://themetaq.com/articles/ajax-ee-sort-and-order-data-with-expressionengine-and-ajax-part-two
I am using a template with a regular 'index' page (where the JS and HTML is) and an 'ajaxlist' template in the same group that contains the solspace:cal stuff.
JS:
$(document).ready( function() {
var sortTable = $('#sort-table tbody'),
trigger = $('.trigger');
trigger.click( function() {
var ajaxTarget = '<template name>/ajaxlist/' + $(this).attr('data-orderby') + '/';
sortTable.load(ajaxTarget);
return false;
});
});
index:
<a href="{path='<template name>/ajaxlist/test'}" class="trigger" data-orderby="test">Test</a>
<table id="sort-table">
{embed="<template name>/ajaxlist"}
</table>
ajaxlist
<tbody>
{if segment_3 == 'test'}
{exp:calendar:cal first_day_of_week="{current_time format="%w"}" date_range_start="today"}
{display_each_day}
{events}
{event_title}
{/events}
{/display_each_day}
{/exp:calendar:cal}
{/if}
</tbody>
please note that the ajaxlist code (without the js to load via ajax) redirects to the url appropriately and loads the data just fine.
PROBLEM
When we add the JS it runs but instead of returning the stuff inside 'ajaxlist' it returns the entire web page again inside the <tbody>
! (Nesting the page within itself :p). I really don't know why and would like some help one what steps to take to remedy this to use in conjunction with ajax or with EE.
A coworker of mine suggested that the 'test' variable isn't working because we don't have (and rightly shouldn't have) anything named 'test'. I'm really confused at this point.
Thanks
EDIT 1:
I should note that even when removing the 'test' element from all of the code and just used <template name>/ajaxlist
it still returns the entire page.