Welcome Guest, Not a member yet? Register   Sign In
How to pass ANYTHING to CI via jQuery's $.get() method....
#1

[eluser]stormbytes[/eluser]
This should have taken all of 5 minutes, but alas....

I'm trying to make a simple jQuery ajax call using $.get() and pass some params to the receiving CI function:

Here's the controller's method:
Code:
// Tried this first

public function test($foo)
{    
    $this->firephp->log($foo, 'GET Arr');
    
    if( ! $foo)
    {
        echo 0;
    }
    else
    {
        $stack = json_decode($foo);
    
        echo 'GET success: ' .$stack->stack_id;
    }
}


// Then I tried this...

public function test()
{
    $foo = $this->input->get('', TRUE);
    
    $this->firephp->log($foo, 'GET Arr');
    
    if( ! $foo)
    {
        echo 0;
    }
    else
    {
        $stack = json_decode($foo);
    
        echo 'GET success: ' .$stack->stack_id;
    }
}

Both times I'm getting 'FALSE' for GET. That is, no data is being received....

Here's the jQuery code:
Code:
$.get('http://sandbox/ajax/test', {'foo':'bar'}, function(data) {
        alert(data);
    });

Is there some bug or setting I'm unaware of? Mind boggling...
#2

[eluser]bgreene[/eluser]
$.post(...)
#3

[eluser]stormbytes[/eluser]
[quote author="bgreene" date="1303391468"]$.post(...)[/quote]

How lame is it that a mainstream framework in its 4th or 5th public release/revision needs users to do backflips and cartwheels around Ajax calls....

This is my biggest CI disappointment to date.




Theme © iAndrew 2016 - Forum software by © MyBB