Welcome Guest, Not a member yet? Register   Sign In
Another CSFR question
#8

[eluser]keld[/eluser]
Hmmmm I still can't it to work, this is what I have in my js:
Code:
$('div#star-rating div.rate_widget').each(function(i) {
        var widget = this;
        var csrf_token = $.cookie("csrf_token_mysite");
        $.ajax({
            url: base_url+"recipes/recipeRatings",
            data: {widget_id : $(widget).attr('id'), fetch: 1, csrf_token_name: csrf_token},
            type: "POST",
            cache: false,
            dataType: "json",
            success: function(data){
                $(widget).data( 'fsr', data );
                set_votes(widget);
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                $("#star-rating").find('#total_votes').text("Error parsing data. Try again later.");
            }
        });
    });

and my controller:
Code:
if(is_ajax())
        {
            if(isset($_POST['fetch']))
            {
                $rating_values = $this->Mc_home->getRatings();
                $this->firephp->log(json_encode($rating_values), "reading votes");
                echo json_encode($rating_values);
            }
}

The console give me a 500 server error even before entering the controller, it gets stuck in the post in my js file.


Messages In This Thread
Another CSFR question - by El Forum - 05-10-2011, 06:01 PM
Another CSFR question - by El Forum - 05-10-2011, 06:50 PM
Another CSFR question - by El Forum - 05-10-2011, 06:59 PM
Another CSFR question - by El Forum - 05-10-2011, 10:44 PM
Another CSFR question - by El Forum - 05-11-2011, 12:17 AM
Another CSFR question - by El Forum - 05-11-2011, 03:19 AM
Another CSFR question - by El Forum - 05-11-2011, 03:25 AM
Another CSFR question - by El Forum - 05-11-2011, 01:51 PM
Another CSFR question - by El Forum - 05-11-2011, 02:06 PM
Another CSFR question - by El Forum - 05-11-2011, 03:02 PM
Another CSFR question - by El Forum - 05-12-2011, 03:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB