Hello Alexandru,
long time i could not care with this problem.
Again the same problem...
alert(typeof(request)) returns "undefined"
this is my code in acionts class
$output = '[["title", "My basic letter"], ["name", "Mr Brown"]]';
$this->getResponse()->setHttpHeader("X-JSON", '('.$output.')');
return sfView::HEADER_ONLY;
and this is where i call:
<?php echo jq_link_to_remote('Refresh the letter', array(
'url' => 'friend/test',
'dataType' => 'json',
'complete' => 'alert(typeof(request));updateJSON(request)'
)) ?>
<?php echo jq_javascript_tag("
function updateJSON(request)
{ alert('asdasd');
var nbElementsInResponse = json.length;
for (var i = 0; i < nbElementsInResponse; i++)
{
Element.update(json[i][0], json[i][1]);
}
}
") ?>
Returns nothing.
But when i try this way in action,
$output = '[["title", "My basic letter"], ["name", "Mr Brown"]]';
$this->getResponse()->setContentType("application/json; charset=utf-8");
$this->renderText( $output );
return sfView::NONE;
i got
[["title", "My basic letter"], ["name", "Mr Brown"]]
but the same error :
"request is not defined"
--- 20/04/09 Pzt tarihinde Alexandru-Emil Lupu <[email protected]> şöyle
yazıyor:
Kimden: Alexandru-Emil Lupu <[email protected]>
Konu: [symfony-users] Re: jquery - json problem
Kime: [email protected]
Tarihi: 20 Nisan 2009 Pazartesi, 20:18
hi!
What is returning this ?
$this->getResponse()->setHttpHeader("X-JSON", '('.$output.')');
i might think your JSON response is bad.
and also js variable "REQUEST" is not defined in
<?php echo jq_link_to_remote('Refresh the letter', array(
'url' => 'test/test',
'dataType' => 'json',
'complete' => 'updateJSON(request, json)'
)) ?>
I do not know the issues but it might help you out to " alert(typeof(request))
" inside the js code
On Mon, Apr 20, 2009 at 5:32 PM, Guychmyrat Amanmyradov
<[email protected]> wrote:
Hello. i am tring to use jquery + json but there is a problem :
<?php echo jq_link_to_remote('Refresh the letter', array(
'url' => 'test/test',
'dataType' => 'json',
'complete' => 'updateJSON(request, json)'
)) ?>
i got
request is not definedonclick()()
error.
my test function is :
public function executeTest()
{
$output = '[["title", "My basic letter"], ["name", "Mr Brown"]]';
$this->getResponse()->setHttpHeader("X-JSON", '('.$output.')');
return sfView::HEADER_ONLY;
}
js function is
:
function updateJSON(request, json)
{
alert(json.length);
}
what is the problem.. ?
Yahoo! Türkiye açıldı!
Haber, Ekonomi, Videolar, Oyunlar hepsi Yahoo! Türkiye'de!
www.yahoo.com.tr
___________________________________________________________________
Yahoo! Türkiye açıldı! http://yahoo.com.tr
İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---