Welcome Guest, Not a member yet? Register   Sign In
$.ajax issue
#1

[eluser]jacobson[/eluser]
Hello I have a problem with my application. I have on my page

Code:
<div id="newsList">
</div>

and I have mechanism which takes the selected checkboxes and filters the news displayed on the screen.

I have my $.ajax function
Code:
$.ajax({
            type : 'POST',
            url : 'http://localhost/ajaxCall',
            data: {
                action : 'getNews',
                categories : categories
            },
            success : function(data){
                $('#newsList').fadeOut(200, function(){
                    $('#newsList').html(data);
                    $('#newsList').fadeIn();
                });
            }
        });

this code should go to my site_controller/ajaxCall (i have routing) and site_controller is a default controller.
Inside the ajaxCall method i have

Code:
function ajaxCall() {
        switch ($_POST['action']) {
            case 'getNews' : getNewsByCategories($_POST['categories']);
                break;
        }
    }

and in the getNewsByCategories function i simply have

Code:
echo "1";

in order to show 1 inside the newsList div on my page. But It's not working. Mabe I made a mistake earlier but I cant find it, mabe a fresh eye will find an issue. I would appreciate your help Smile



//edit

omg... im gonna explode Tongue
inside ajaxCall should be $this->getNewsByCategories($_POST['categories']); ....
anyway thx Smile




Theme © iAndrew 2016 - Forum software by © MyBB