thanx for the reply marcelo....
so i think i need to reconsider a better understanding of cakephp
therefore i now turned into a much simple program in cakephp
using all its feature ....
but still am not able to get the value from jquery to a controller in
cakephp
heres what i did....
i created a controller as follows
beers_controller.php
=======================================
<?php
class BeersController extends AppController
{
var $name = "Beers";
var $uses = null;
var $helpers = array('Form', 'Html', 'Javascript',
'Time','Paginator','Ajax');
var $components = array('RequestHandler','Email');
function view_beer()
{
print_r($this->params);
}
function add_beer()
{
Configure::write('debug', 0);
$this->autoRender = false;
if($this->RequestHandler->isAjax())
{
$this->Session->write('BeersInOurSession',
$this->params['form']['id']);
pr($this->Session->read('BeersInOurSession'));
print_r($this->Session->read('BeersInOurSession'));
}
print_r($this->Session->read('BeersInOurSession'));
$pop = $this->Session->read('BeersInOurSession');
print_r($pop);
echo "pop=$pop";
}
}
?>
=======================================
=>what i have did here is just created a view page for the function
view_beer() which contains
just a simple link and i have passed a value of id thru it...
i used jquery to post this value and need this value in the contoller to be
viewd but still no go,
heres my view file
view_beer.ctp
==========================================
<?php
//let's load up the jQuery core
echo $javascript->link('jquery-1.3.2.min');
//and now... some file that will be specific to this view (page)
echo $javascript->link('beers_view_beer');
?>
<?php echo $html->link('add beer', '#', array('onclick'=>'return false;',
'id'=>'some-beer-name', 'class'=>'add-beer-link')); ?>
<?
echo "<br/>";
echo "<br/>";
echo "<br/>";
$pp = $session->read('BeersInOurSession');
echo "pop=$pp";
?>
===========================================
=>as u can see its just an id thts am trying to get in the controller
printed
ie. in this case would be " some-beer-name ".......................
my javascript file for this is
beers_view_beer.js
=========================================
$(document).ready(function() {
$('.add-beer-link').click( function () {
$.post('/beers/add_beer', {id: $(this).attr('id')});
});
});
=========================================
=Isn't this a pretty simple stufff.......................
=>Am really getting frustrated......
=>is there something that am doing wrong.............
=>Or is there any other method to get the values displayed
=>ANY HELP WOULD BE GREATLY APPRECIATED..........
=> THANZ IN ADVANCEEE...........................
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---