[symfony-users] Jquery and AJAX symfony 1.4

2010-04-19 Thread trankh
Hello,

I want to call a simple action without passing any argument inside a
jquery function.
No argument because a random function is called inside the action.

The routing (in input and output) is this:
plantyourtree:
  url:   /tree/plantyourtree
  param: { module: tree, action: new }

the js file looks like this:

$(document).ready(function()
{

$('#change').click(function(){

?
});

});


The action associated with is:

 public function executeNew(sfWebRequest $request)
  {

   $this-zulu_tree_sample = Doctrine::getTable('ZuluTree')-
find(rand(1,Doctrine::getTable('ZuluTree')-count()));


$this-form = new ZuluTreeForm();

  if ($request-isXmlHttpRequest())
  {
  ?
  }


  }

In the template newSuccess.php, there is a form and a div where we
display information relative to zulu_tree_sample and which needs to be
refreshed each time we push the change button.

The template associated with is:

div id=left_column
?php echo $zulu_tree_sample-getName() ?
/div

input type=submit id=change value=Change



div id=right_column
?php include_partial('form', array('form' = $form)) ?
/div




I dont' know what to put instead of ??

Thank you

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Jquery and AJAX symfony 1.4

2010-04-19 Thread Welington Veiga
Well, it's very easy, use ajax like a single php file.

View:
Use a the helper ?php echo url_for('YOUR_MODULE/index'); ? to decide for
what URL to send, inside your script tag, assign to a javascript variable

Controller (action)
$this-getResponse()-setHttpHeader('Content-type','text/json');
return $this-renderText('SOMETHING VERY USEFULLY);

All the other interactions will be equal,





2010/4/19 trankh juliend1...@gmail.com

 Hello,

 I want to call a simple action without passing any argument inside a
 jquery function.
 No argument because a random function is called inside the action.

 The routing (in input and output) is this:
 plantyourtree:
  url:   /tree/plantyourtree
  param: { module: tree, action: new }

 the js file looks like this:

 $(document).ready(function()
 {

 $('#change').click(function(){

 ?
});

 });


 The action associated with is:

  public function executeNew(sfWebRequest $request)
  {

   $this-zulu_tree_sample = Doctrine::getTable('ZuluTree')-
 find(rand(1,Doctrine::getTable('ZuluTree')-count()));


$this-form = new ZuluTreeForm();

  if ($request-isXmlHttpRequest())
  {
  ?
  }


  }

 In the template newSuccess.php, there is a form and a div where we
 display information relative to zulu_tree_sample and which needs to be
 refreshed each time we push the change button.

 The template associated with is:

 div id=left_column
 ?php echo $zulu_tree_sample-getName() ?
 /div

 input type=submit id=change value=Change



 div id=right_column
 ?php include_partial('form', array('form' = $form)) ?
 /div




 I dont' know what to put instead of ??

 Thank you

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Welington da Veiga Silva
---
Há pessoas que transformam o sol numa simples mancha amarela, mas há
aquelas que fazem de uma simples mancha amarela o próprio sol.
( Pablo Picasso )

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en