Kohana 3 jQuery/AJAX request not working

Posted by dscher on Stack Overflow See other posts from Stack Overflow or by dscher
Published on 2010-05-12T22:49:57Z Indexed on 2010/05/12 22:54 UTC
Read the original article Hit count: 442

Filed under:
|
|
|
|

I am trying to post some data to a controller in Kohana 3 using the jQuery AJAX method. I seem to have an issue with the data not getting to where I want it to be. I want the data to go to the /application/classes/controller/stock.php file where the file will process the data. I can't seem to figure this one out. Hopefully someone can help. My jQuery ajax call is:

        $.ajax({
            type: 'POST',
            url: 'add_stock',
            data: { 'links': 'link_array' }
            });

'add_stock' is the name of the action within the controller. I didn't know what else to try. I've also tried '.' and './' hoping that would be right but it's not. In Firebug, although it says the request was 200 OK, I see that the "RESPONSE" is "Failed to load source for: http://localhost/ddm/v2/stocks/add_stock" and my script in my controller which grabs the data isn't working. Here is that code in case it helps:

$links = $_POST['links'];

$link_obj = Jelly::factory('link')
    ->set('stock', $stock->id)
    ->set('links', $links);

    $link_obj->save();

I think that the problem is that I'm giving the ajax call the ROUTE and not the actual page it needs to deliver the POST data to. I just can't figure it out here.

Any help?

© Stack Overflow or respective owner

Related posts about kohana

Related posts about AJAX