﻿/*global jQuery */

jQuery(function($)
{

    $('#PagingDicoRecette a').livequery('click', loadPage);
    
    function loadPage (sender)
    {  
        var strHREF = $(this).attr("href");
        
        $.ajax(
        {
            url: strHREF,
            method: 'GET',
            dataType: 'xml',
            success: onLoadPage,
            error: onLoadPageError
            
        });
        
        return false;
    }
    
    function onLoadPage (_strXML)
    {
        
        var $xml = $(_strXML, "xml");
        
        var strCategories = $xml.find('recettes').text();
        
        $('#ListeDicoRecettes').empty().append(strCategories);;
        
        
        var strPaging = $xml.find('paging').text();
        $('#PagingDicoRecette').empty().append(strPaging);
        
    }
    
    function onLoadPageError (sender)
    {
        alert("onLoadPageError");
    }

});
