Hello all,

I am using Symfony 1.2.2 with doctrine plugin and jQuery. I am trying
to create an small application making use of AJAX helper
submit_to_remote(). My response contains JSON format string so I need
to create a callback.

http://www.symfony-project.org/book/1_0/11-Ajax-Integration#chapter_11_json

In this part of documentation I read that the JSON format was being
passed from action directly bypassing the view layer entirely using
the following code

$output = '[["title", "My basic letter"], ["name", "Mr Brown"]]';
$this->getResponse()->setHttpHeader("X-JSON", '('.$output.')');
return sfView::HEADER_ONLY;

I want to send the JSON data using $this->renderText() function...so
will changing the code like this work ???

$output = '[["title", "My basic letter"], ["name", "Mr Brown"]]';
$this->getResponse()->setContentType("text/x-json");   // I am
changing the response header type here
return $this->renderText( $output );   // I am sending the json data
here

This doesn't work for me if I have a callback like this...

function updateJSON(request, json)
{
   alert(json);     // this displays null
}

Am I setting contentType wrong? or is there something else that I have
goofed up?

thanks and regards
Vikram


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to