• Hello there!

    I have a function calendar($interval) {…}
    If $interval == 0, the current month will be generated. If it’s value is 1, then the next month will be generated, if it’s -1, the previous month will be generated and so on..

    Well, i need to make two buttons which will scroll between months, a next button which will increment the interval value and a previous button which will decrement the interval value.

    This must be done via ajax, the function calendar is called inside a div with id=”calendar”

    I need help doing this… I followed this guide (http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/#comment-572) to implement the ajax calls correctly, but i’m a bit lost on how to update the div with the calendar using the new value for the interval.

    You can see the calendar working (without the scroll functionality of course) at http://espacofluxo.com.br/

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter GabrielJT

    (@gabrieljt)

    Well I’ve had some advances!!

    I was able to send the new interval value via ajax, process the calendar with the new value and return it with all the html.

    But how do i override the content of the div calendar with the response?

    jQuery.post(
    // see tip #1 for how we declare global javascript variables
    MyAjax.ajaxurl,
    {
    // here we declare the parameters to send along with the request
    // this means the following action hooks will be fired:
    // wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit
    action : ‘myajax-submit’,

    // other parameters can be added along with “action”
    intervalo : 1
    },
    function( response ) {
    alert( response );
    }
    );

    The alert brings up all the html code of the next month, just need to put this in the calendar div overriding the previous month..

    Thanks!!

    Thread Starter GabrielJT

    (@gabrieljt)

    I got it now ;D

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Calendar Scroll with Ajax’ is closed to new replies.