Hy, i''ve would like to know, using protorype.js file, to load a file in two div with one link... Is it possibile? thx... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
<a href="javascript:new Ajax.Updater(''div-id'',
''page.php'',
{options});">Link</a>
<div id="div-id">Read the API!</div>
On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hy, i''ve would like to know, using protorype.js file, to load a
file
> in two div with one link...
> Is it possibile?
> thx...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Read your question to quick =]
You can do it the unobstrusive way...
$(''myLink'').observe(''click'', function(ev){
ev.stop();
[''id-1'',
''id-2''].each(function(single_id){
new Ajax.Updater(single_id, ''page.php'', {options});
});
});
On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> <a href="javascript:new Ajax.Updater(''div-id'',
''page.php'',
> {options});">Link</a>
>
> <div id="div-id">Read the API!</div>
>
> On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Hy, i''ve would like to know, using protorype.js file, to load
a file
> > in two div with one link...
> > Is it possibile?
> > thx...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Thx for answer, but in this case where I put the link? I have to load this page with this link: /sort.php/id=5&read=3 Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] top show my case page. Can you explain me with an ex short code page? On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Read your question to quick =] > > You can do it the unobstrusive way... > > $(''myLink'').observe(''click'', function(ev){ > ev.stop(); > [''id-1'', ''id-2''].each(function(single_id){ > new Ajax.Updater(single_id, ''page.php'', {options}); > }); > > }); > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > {options});">Link</a> > > > <div id="div-id">Read the API!</div> > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > in two div with one link... > > > Is it possibile? > > > thx...- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Put the link in you html source.. (where else?)
<a href="/sort.php/id=5&read=3" id="theLink">Click
this weird link =]</
a>
Then,
$(''theLink'').observe(''click'',
function(event){
event.stop(); //<-- this stops the link from actually redirecting
you to the page...
[''div1'',
''div2''].each(function(single_id){
new Ajax.Updater(single_id,
event.element().readAttribute(''href''), {options});
});
});
On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Thx for answer, but in this case where I put the link?
> I have to load this page with this link: /sort.php/id=5&read=3
>
> Then in div1: i can $_GET [''id''], and in div2 i can
$_GET[''read'']
> top show my case page.
>
> Can you explain me with an ex short code page?
>
> On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Read your question to quick =]
>
> > You can do it the unobstrusive way...
>
> > $(''myLink'').observe(''click'',
function(ev){
> > ev.stop();
> > [''id-1'',
''id-2''].each(function(single_id){
> > new Ajax.Updater(single_id, ''page.php'',
{options});
> > });
>
> > });
>
> > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > {options});">Link</a>
>
> > > <div id="div-id">Read the API!</div>
>
> > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > Hy, i''ve would like to know, using protorype.js
file, to load a file
> > > > in two div with one link...
> > > > Is it possibile?
> > > > thx...- Nascondi testo tra virgolette -
>
> > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Updating two different target from one result is not as one target,
but it is possible. A way to accomplish this is to send back the
result in a JSON format and parse it on the client side.
If you are using PHP on the backend, json_encode is your friend.
(http://nl3.php.net/manual/nl/ref.json.php)
It can transform arrays and what not into a JSON format for easy use
by other languages... like javascript.
<?php
header(''Content-type: application/json'');
echo json_encode(array(''id'' => 364,
''read'' => ''Lorem ipsum''));
?>
// { ''id'': ''364'', ''read'':
''Lorem ipsum''}
This response is then easily parsed with the ''new'' reponseJSON
in the
Ajax class.
new Ajax.Request(''url.php'', {
onComplete: function(transport) {
var json = transport.responseJSON;
$(''div1'').update(json.id);
$(''div2'').update(json.read);
}
});
t.responseJSON has been added in version 1.6.0 of prototype. Keep one
thing in mind though... you HAVE to set the content type of the
response to "Content-type: application/json", otherwise prototype will
not recognize it as json.
Greetz,
Wizz
On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Thx for answer, but in this case where I put the link?
> I have to load this page with this link: /sort.php/id=5&read=3
>
> Then in div1: i can $_GET [''id''], and in div2 i can
$_GET[''read'']
> top show my case page.
>
> Can you explain me with an ex short code page?
>
> On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Read your question to quick =]
>
> > You can do it the unobstrusive way...
>
> > $(''myLink'').observe(''click'',
function(ev){
> > ev.stop();
> > [''id-1'',
''id-2''].each(function(single_id){
> > new Ajax.Updater(single_id, ''page.php'',
{options});
> > });
>
> > });
>
> > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > {options});">Link</a>
>
> > > <div id="div-id">Read the API!</div>
>
> > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > Hy, i''ve would like to know, using protorype.js
file, to load a file
> > > > in two div with one link...
> > > > Is it possibile?
> > > > thx...- Nascondi testo tra virgolette -
>
> > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
<?php
header(''Content-type: application/json'');
?>
I put this in the index.php page? This is the page where a load all
div...
And
new Ajax.Request(''url.php'', {
onComplete: function(transport) {
var json = transport.responseJSON;
$(''div1'').update(json.id);
$(''div2'').update(json.read);
}
});
Also this code I put in the same page between tag <script></script>?
And the link that call this one?
Sorry but it''s first time, and I''ve a lot of confusion...
On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Updating two different target from one result is not as one target,
> but it is possible. A way to accomplish this is to send back the
> result in a JSON format and parse it on the client side.
>
> If you are using PHP on the backend, json_encode is your friend.
> (http://nl3.php.net/manual/nl/ref.json.php)
> It can transform arrays and what not into a JSON format for easy use
> by other languages... like javascript.
>
> <?php
> header(''Content-type: application/json'');
> echo json_encode(array(''id'' => 364,
''read'' => ''Lorem ipsum''));
> ?>
> // { ''id'': ''364'',
''read'': ''Lorem ipsum''}
>
> This response is then easily parsed with the ''new''
reponseJSON in the
> Ajax class.
>
> new Ajax.Request(''url.php'', {
>
> onComplete: function(transport) {
> var json = transport.responseJSON;
> $(''div1'').update(json.id);
> $(''div2'').update(json.read);
> }
>
> });
>
> t.responseJSON has been added in version 1.6.0 of prototype. Keep one
> thing in mind though... you HAVE to set the content type of the
> response to "Content-type: application/json", otherwise prototype
will
> not recognize it as json.
>
> Greetz,
>
> Wizz
>
> On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > Thx for answer, but in this case where I put the link?
> > I have to load this page with this link: /sort.php/id=5&read=3
>
> > Then in div1: i can $_GET [''id''], and in div2 i can
$_GET[''read'']
> > top show my case page.
>
> > Can you explain me with an ex short code page?
>
> > On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Read your question to quick =]
>
> > > You can do it the unobstrusive way...
>
> > > $(''myLink'').observe(''click'',
function(ev){
> > > ev.stop();
> > > [''id-1'',
''id-2''].each(function(single_id){
> > > new Ajax.Updater(single_id, ''page.php'',
{options});
> > > });
>
> > > });
>
> > > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > > {options});">Link</a>
>
> > > > <div id="div-id">Read the API!</div>
>
> > > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > Hy, i''ve would like to know, using
protorype.js file, to load a file
> > > > > in two div with one link...
> > > > > Is it possibile?
> > > > > thx...- Nascondi testo tra virgolette -
>
> > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
<html xmlns="http://www.w3.org/1999/xhtml" lang="it"
xml:lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script src="js/prototype.js"
type="text/javascript"></script>
<body marginwidth="0" marginheight="0"
topmargin="0" bottommargin="0"
leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(''includes/header.php''); ?>
<!-- header_eof //-->
<table id="Table_01" width="764" height="650"
border="0"
cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="764" height="100%" align="center"
valign="top">
<div id="content"><a
href="boxes/project.php?type=housing">link</a</
div></td>
<div id="box"></div>
<div id="box2"></div>
</td>
</tr>
</table>
</body>
</html>
Well, this is my page, how can load my page linked in box and box2?
Please, i''ve not understood before...
On 26 Nov, 17:59, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> <?php
> header(''Content-type: application/json'');
> ?>
> I put this in the index.php page? This is the page where a load all
> div...
>
> And
> new Ajax.Request(''url.php'', {
>
> onComplete: function(transport) {
> var json = transport.responseJSON;
> $(''div1'').update(json.id);
> $(''div2'').update(json.read);
> }
>
> });
>
> Also this code I put in the same page between tag
<script></script>?
> And the link that call this one?
> Sorry but it''s first time, and I''ve a lot of confusion...
>
> On 26 Nov, 16:55, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Updating two different target from one result is not as one target,
> > but it is possible. A way to accomplish this is to send back the
> > result in a JSON format and parse it on the client side.
>
> > If you are using PHP on the backend, json_encode is your friend.
> > (http://nl3.php.net/manual/nl/ref.json.php)
> > It can transform arrays and what not into a JSON format for easy use
> > by other languages... like javascript.
>
> > <?php
> > header(''Content-type: application/json'');
> > echo json_encode(array(''id'' => 364,
''read'' => ''Lorem ipsum''));
> > ?>
> > // { ''id'': ''364'',
''read'': ''Lorem ipsum''}
>
> > This response is then easily parsed with the ''new''
reponseJSON in the
> > Ajax class.
>
> > new Ajax.Request(''url.php'', {
>
> > onComplete: function(transport) {
> > var json = transport.responseJSON;
> > $(''div1'').update(json.id);
> > $(''div2'').update(json.read);
> > }
>
> > });
>
> > t.responseJSON has been added in version 1.6.0 of prototype. Keep one
> > thing in mind though... you HAVE to set the content type of the
> > response to "Content-type: application/json", otherwise
prototype will
> > not recognize it as json.
>
> > Greetz,
>
> > Wizz
>
> > On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Thx for answer, but in this case where I put the link?
> > > I have to load this page with this link:
/sort.php/id=5&read=3
>
> > > Then in div1: i can $_GET [''id''], and in div2 i
can $_GET[''read'']
> > > top show my case page.
>
> > > Can you explain me with an ex short code page?
>
> > > On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > Read your question to quick =]
>
> > > > You can do it the unobstrusive way...
>
> > > >
$(''myLink'').observe(''click'', function(ev){
> > > > ev.stop();
> > > > [''id-1'',
''id-2''].each(function(single_id){
> > > > new Ajax.Updater(single_id,
''page.php'', {options});
> > > > });
>
> > > > });
>
> > > > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > > > {options});">Link</a>
>
> > > > > <div id="div-id">Read the
API!</div>
>
> > > > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > Hy, i''ve would like to know, using
protorype.js file, to load a file
> > > > > > in two div with one link...
> > > > > > Is it possibile?
> > > > > > thx...- Nascondi testo tra virgolette -
>
> > > > - Mostra testo tra virgolette -- Nascondi testo tra
virgolette -
>
> > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I try with:
<a href="#" onclick="new
Ajax.Request(''boxes/project_.php?
type=urbandesign'', {
onComplete: function(transport) {
var json = transport.responseJSON;
$(''box'').update(json.type);
$(''box3'').update(json.type);
}
}); " >xxx</a>
but nothing... can you help me again?
Thx...
On 26 Nov, 20:57, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> <html xmlns="http://www.w3.org/1999/xhtml" lang="it"
xml:lang="it">
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
>
> <script src="js/prototype.js"
type="text/javascript"></script>
> <body marginwidth="0" marginheight="0"
topmargin="0" bottommargin="0"
> leftmargin="0" rightmargin="0">
> <!-- header //-->
> <?php require(''includes/header.php''); ?>
> <!-- header_eof //-->
>
> <table id="Table_01" width="764"
height="650" border="0"
> cellpadding="0" cellspacing="0"
align="center">
> <tr>
> <td width="764" height="100%"
align="center" valign="top">
> <div id="content"><a
href="boxes/project.php?type=housing">link</a</
> div></td>
>
> <div id="box"></div>
> <div id="box2"></div>
>
> </td>
> </tr>
>
> </table>
> </body>
> </html>
>
> Well, this is my page, how can load my page linked in box and box2?
> Please, i''ve not understood before...
> On 26 Nov, 17:59, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > <?php
> > header(''Content-type: application/json'');
> > ?>
> > I put this in the index.php page? This is the page where a load all
> > div...
>
> > And
> > new Ajax.Request(''url.php'', {
>
> > onComplete: function(transport) {
> > var json = transport.responseJSON;
> > $(''div1'').update(json.id);
> > $(''div2'').update(json.read);
> > }
>
> > });
>
> > Also this code I put in the same page between tag
<script></script>?
> > And the link that call this one?
> > Sorry but it''s first time, and I''ve a lot of
confusion...
>
> > On 26 Nov, 16:55, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Updating two different target from one result is not as one
target,
> > > but it is possible. A way to accomplish this is to send back the
> > > result in a JSON format and parse it on the client side.
>
> > > If you are using PHP on the backend, json_encode is your friend.
> > > (http://nl3.php.net/manual/nl/ref.json.php)
> > > It can transform arrays and what not into a JSON format for easy
use
> > > by other languages... like javascript.
>
> > > <?php
> > > header(''Content-type: application/json'');
> > > echo json_encode(array(''id'' => 364,
''read'' => ''Lorem ipsum''));
> > > ?>
> > > // { ''id'': ''364'',
''read'': ''Lorem ipsum''}
>
> > > This response is then easily parsed with the
''new'' reponseJSON in the
> > > Ajax class.
>
> > > new Ajax.Request(''url.php'', {
>
> > > onComplete: function(transport) {
> > > var json = transport.responseJSON;
> > > $(''div1'').update(json.id);
> > > $(''div2'').update(json.read);
> > > }
>
> > > });
>
> > > t.responseJSON has been added in version 1.6.0 of prototype. Keep
one
> > > thing in mind though... you HAVE to set the content type of the
> > > response to "Content-type: application/json", otherwise
prototype will
> > > not recognize it as json.
>
> > > Greetz,
>
> > > Wizz
>
> > > On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > Thx for answer, but in this case where I put the link?
> > > > I have to load this page with this link:
/sort.php/id=5&read=3
>
> > > > Then in div1: i can $_GET [''id''], and in
div2 i can $_GET[''read'']
> > > > top show my case page.
>
> > > > Can you explain me with an ex short code page?
>
> > > > On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > Read your question to quick =]
>
> > > > > You can do it the unobstrusive way...
>
> > > > >
$(''myLink'').observe(''click'', function(ev){
> > > > > ev.stop();
> > > > > [''id-1'',
''id-2''].each(function(single_id){
> > > > > new Ajax.Updater(single_id,
''page.php'', {options});
> > > > > });
>
> > > > > });
>
> > > > > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > > > > {options});">Link</a>
>
> > > > > > <div id="div-id">Read the
API!</div>
>
> > > > > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > Hy, i''ve would like to know, using
protorype.js file, to load a file
> > > > > > > in two div with one link...
> > > > > > > Is it possibile?
> > > > > > > thx...- Nascondi testo tra virgolette -
>
> > > > > - Mostra testo tra virgolette -- Nascondi testo tra
virgolette -
>
> > > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I made a quick and very basic example for you to make it a bit clearer. http://newmillineon.nl/lab/semolino/ If you want to take a look at the code and structure, I zipped it all up for you. http://newmillineon.nl/lab/semolino/load-two-divs.zip Hope you grab the concept a little bit now... otherwise you might want to take a step back and learn a few things more before you try something like this again. Greetz, Wizz On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I try with: > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > type=urbandesign'', { > > onComplete: function(transport) { > var json = transport.responseJSON; > $(''box'').update(json.type); > $(''box3'').update(json.type); > } > > }); " >xxx</a> > > but nothing... can you help me again? > Thx... > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > <head> > > <meta http-equiv="Content-Type" content="text/html; > > charset=iso-8859-1" /> > > > <script src="js/prototype.js" type="text/javascript"></script> > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > leftmargin="0" rightmargin="0"> > > <!-- header //--> > > <?php require(''includes/header.php''); ?> > > <!-- header_eof //--> > > > <table id="Table_01" width="764" height="650" border="0" > > cellpadding="0" cellspacing="0" align="center"> > > <tr> > > <td width="764" height="100%" align="center" valign="top"> > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > div></td> > > > <div id="box"></div> > > <div id="box2"></div> > > > </td> > > </tr> > > > </table> > > </body> > > </html> > > > Well, this is my page, how can load my page linked in box and box2? > > Please, i''ve not understood before... > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > <?php > > > header(''Content-type: application/json''); > > > ?> > > > I put this in the index.php page? This is the page where a load all > > > div... > > > > And > > > new Ajax.Request(''url.php'', { > > > > onComplete: function(transport) { > > > var json = transport.responseJSON; > > > $(''div1'').update(json.id); > > > $(''div2'').update(json.read); > > > } > > > > }); > > > > Also this code I put in the same page between tag <script></script>? > > > And the link that call this one? > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Updating two different target from one result is not as one target, > > > > but it is possible. A way to accomplish this is to send back the > > > > result in a JSON format and parse it on the client side. > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > It can transform arrays and what not into a JSON format for easy use > > > > by other languages... like javascript. > > > > > <?php > > > > header(''Content-type: application/json''); > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > ?> > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > Ajax class. > > > > > new Ajax.Request(''url.php'', { > > > > > onComplete: function(transport) { > > > > var json = transport.responseJSON; > > > > $(''div1'').update(json.id); > > > > $(''div2'').update(json.read); > > > > } > > > > > }); > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > thing in mind though... you HAVE to set the content type of the > > > > response to "Content-type: application/json", otherwise prototype will > > > > not recognize it as json. > > > > > Greetz, > > > > > Wizz > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Thx for answer, but in this case where I put the link? > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > top show my case page. > > > > > > Can you explain me with an ex short code page? > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Read your question to quick =] > > > > > > > You can do it the unobstrusive way... > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > ev.stop(); > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > }); > > > > > > > }); > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > {options});">Link</a> > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > in two div with one link... > > > > > > > > Is it possibile? > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You''re so GREAT!! Now I have what i want... Just at home, i''ll try it soon! Thank you very much, but only a question, the file content.php, is not included in index, why? Which is his function? How it can be needed? Tnx again... On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I made a quick and very basic example for you to make it a bit > clearer.http://newmillineon.nl/lab/semolino/ > > If you want to take a look at the code and structure, I zipped it all > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > Hope you grab the concept a little bit now... otherwise you might want > to take a step back and learn a few things more before you try > something like this again. > > Greetz, > > Wizz > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I try with: > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > type=urbandesign'', { > > > onComplete: function(transport) { > > var json = transport.responseJSON; > > $(''box'').update(json.type); > > $(''box3'').update(json.type); > > } > > > }); " >xxx</a> > > > but nothing... can you help me again? > > Thx... > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > <head> > > > <meta http-equiv="Content-Type" content="text/html; > > > charset=iso-8859-1" /> > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > leftmargin="0" rightmargin="0"> > > > <!-- header //--> > > > <?php require(''includes/header.php''); ?> > > > <!-- header_eof //--> > > > > <table id="Table_01" width="764" height="650" border="0" > > > cellpadding="0" cellspacing="0" align="center"> > > > <tr> > > > <td width="764" height="100%" align="center" valign="top"> > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > div></td> > > > > <div id="box"></div> > > > <div id="box2"></div> > > > > </td> > > > </tr> > > > > </table> > > > </body> > > > </html> > > > > Well, this is my page, how can load my page linked in box and box2? > > > Please, i''ve not understood before... > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > <?php > > > > header(''Content-type: application/json''); > > > > ?> > > > > I put this in the index.php page? This is the page where a load all > > > > div... > > > > > And > > > > new Ajax.Request(''url.php'', { > > > > > onComplete: function(transport) { > > > > var json = transport.responseJSON; > > > > $(''div1'').update(json.id); > > > > $(''div2'').update(json.read); > > > > } > > > > > }); > > > > > Also this code I put in the same page between tag <script></script>? > > > > And the link that call this one? > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Updating two different target from one result is not as one target, > > > > > but it is possible. A way to accomplish this is to send back the > > > > > result in a JSON format and parse it on the client side. > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > by other languages... like javascript. > > > > > > <?php > > > > > header(''Content-type: application/json''); > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > ?> > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > Ajax class. > > > > > > new Ajax.Request(''url.php'', { > > > > > > onComplete: function(transport) { > > > > > var json = transport.responseJSON; > > > > > $(''div1'').update(json.id); > > > > > $(''div2'').update(json.read); > > > > > } > > > > > > }); > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > thing in mind though... you HAVE to set the content type of the > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > not recognize it as json. > > > > > > Greetz, > > > > > > Wizz > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > top show my case page. > > > > > > > Can you explain me with an ex short code page? > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Read your question to quick =] > > > > > > > > You can do it the unobstrusive way... > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > ev.stop(); > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > }); > > > > > > > > }); > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > {options});">Link</a> > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > in two div with one link... > > > > > > > > > Is it possibile? > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
and offline i can''t test the page? You confirm me this? I Itest the page with content, active x block me the function... On 27 Nov, 11:29, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You''re so GREAT!! Now I have what i want... Just at home, i''ll try it > soon! > Thank you very much, but only a question, the file content.php, is not > included in index, why? Which is his function? How it can be needed? > > Tnx again... > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I made a quick and very basic example for you to make it a bit > > clearer.http://newmillineon.nl/lab/semolino/ > > > If you want to take a look at the code and structure, I zipped it all > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > Hope you grab the concept a little bit now... otherwise you might want > > to take a step back and learn a few things more before you try > > something like this again. > > > Greetz, > > > Wizz > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I try with: > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > type=urbandesign'', { > > > > onComplete: function(transport) { > > > var json = transport.responseJSON; > > > $(''box'').update(json.type); > > > $(''box3'').update(json.type); > > > } > > > > }); " >xxx</a> > > > > but nothing... can you help me again? > > > Thx... > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > <head> > > > > <meta http-equiv="Content-Type" content="text/html; > > > > charset=iso-8859-1" /> > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > leftmargin="0" rightmargin="0"> > > > > <!-- header //--> > > > > <?php require(''includes/header.php''); ?> > > > > <!-- header_eof //--> > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > cellpadding="0" cellspacing="0" align="center"> > > > > <tr> > > > > <td width="764" height="100%" align="center" valign="top"> > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > div></td> > > > > > <div id="box"></div> > > > > <div id="box2"></div> > > > > > </td> > > > > </tr> > > > > > </table> > > > > </body> > > > > </html> > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > Please, i''ve not understood before... > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > <?php > > > > > header(''Content-type: application/json''); > > > > > ?> > > > > > I put this in the index.php page? This is the page where a load all > > > > > div... > > > > > > And > > > > > new Ajax.Request(''url.php'', { > > > > > > onComplete: function(transport) { > > > > > var json = transport.responseJSON; > > > > > $(''div1'').update(json.id); > > > > > $(''div2'').update(json.read); > > > > > } > > > > > > }); > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > And the link that call this one? > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Updating two different target from one result is not as one target, > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > result in a JSON format and parse it on the client side. > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > by other languages... like javascript. > > > > > > > <?php > > > > > > header(''Content-type: application/json''); > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > ?> > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > Ajax class. > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > onComplete: function(transport) { > > > > > > var json = transport.responseJSON; > > > > > > $(''div1'').update(json.id); > > > > > > $(''div2'').update(json.read); > > > > > > } > > > > > > > }); > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > not recognize it as json. > > > > > > > Greetz, > > > > > > > Wizz > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > top show my case page. > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Read your question to quick =] > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > ev.stop(); > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > }); > > > > > > > > > }); > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > {options});">Link</a> > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > in two div with one link... > > > > > > > > > > Is it possibile? > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You''re so GREAT!! Now I have what i want... i''ll try it
soon!
Thank you very much, but only a question: if i test offline, activex
block my page,
it''s true? There is a way?
Then, if I want pass 2 variable, or more, in a div?
$(''div1'').update(json.type&date); ???
$(''div2'').update(json.date);
Otherelse i think to pass a variable like this: date=22-11-07|
type=month|id=5
and then split my string by |
It''s possible?
On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I made a quick and very basic example for you to make it a bit
> clearer.http://newmillineon.nl/lab/semolino/
>
> If you want to take a look at the code and structure, I zipped it all
> up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> Hope you grab the concept a little bit now... otherwise you might want
> to take a step back and learn a few things more before you try
> something like this again.
>
> Greetz,
>
> Wizz
>
> On 27 nov, 01:44, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > I try with:
> > <a href="#" onclick="new
Ajax.Request(''boxes/project_.php?
> > type=urbandesign'', {
>
> > onComplete: function(transport) {
> > var json = transport.responseJSON;
> > $(''box'').update(json.type);
> > $(''box3'').update(json.type);
> > }
>
> > }); " >xxx</a>
>
> > but nothing... can you help me again?
> > Thx...
>
> > On 26 Nov, 20:57, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > <html xmlns="http://www.w3.org/1999/xhtml"
lang="it" xml:lang="it">
> > > <head>
> > > <meta http-equiv="Content-Type"
content="text/html;
> > > charset=iso-8859-1" />
>
> > > <script src="js/prototype.js"
type="text/javascript"></script>
> > > <body marginwidth="0" marginheight="0"
topmargin="0" bottommargin="0"
> > > leftmargin="0" rightmargin="0">
> > > <!-- header //-->
> > > <?php require(''includes/header.php''); ?>
> > > <!-- header_eof //-->
>
> > > <table id="Table_01" width="764"
height="650" border="0"
> > > cellpadding="0" cellspacing="0"
align="center">
> > > <tr>
> > > <td width="764"
height="100%" align="center" valign="top">
> > > <div id="content"><a
href="boxes/project.php?type=housing">link</a</
> > > div></td>
>
> > > <div id="box"></div>
> > > <div id="box2"></div>
>
> > > </td>
> > > </tr>
>
> > > </table>
> > > </body>
> > > </html>
>
> > > Well, this is my page, how can load my page linked in box and
box2?
> > > Please, i''ve not understood before...
> > > On 26 Nov, 17:59, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > <?php
> > > > header(''Content-type:
application/json'');
> > > > ?>
> > > > I put this in the index.php page? This is the page where a
load all
> > > > div...
>
> > > > And
> > > > new Ajax.Request(''url.php'', {
>
> > > > onComplete: function(transport) {
> > > > var json = transport.responseJSON;
> > > > $(''div1'').update(json.id);
> > > > $(''div2'').update(json.read);
> > > > }
>
> > > > });
>
> > > > Also this code I put in the same page between tag
<script></script>?
> > > > And the link that call this one?
> > > > Sorry but it''s first time, and I''ve a lot
of confusion...
>
> > > > On 26 Nov, 16:55, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > Updating two different target from one result is not as
one target,
> > > > > but it is possible. A way to accomplish this is to send
back the
> > > > > result in a JSON format and parse it on the client
side.
>
> > > > > If you are using PHP on the backend, json_encode is
your friend.
> > > > > (http://nl3.php.net/manual/nl/ref.json.php)
> > > > > It can transform arrays and what not into a JSON format
for easy use
> > > > > by other languages... like javascript.
>
> > > > > <?php
> > > > > header(''Content-type:
application/json'');
> > > > > echo json_encode(array(''id'' =>
364, ''read'' => ''Lorem ipsum''));
> > > > > ?>
> > > > > // { ''id'': ''364'',
''read'': ''Lorem ipsum''}
>
> > > > > This response is then easily parsed with the
''new'' reponseJSON in the
> > > > > Ajax class.
>
> > > > > new Ajax.Request(''url.php'', {
>
> > > > > onComplete: function(transport) {
> > > > > var json = transport.responseJSON;
> > > > > $(''div1'').update(json.id);
> > > > > $(''div2'').update(json.read);
> > > > > }
>
> > > > > });
>
> > > > > t.responseJSON has been added in version 1.6.0 of
prototype. Keep one
> > > > > thing in mind though... you HAVE to set the content
type of the
> > > > > response to "Content-type: application/json",
otherwise prototype will
> > > > > not recognize it as json.
>
> > > > > Greetz,
>
> > > > > Wizz
>
> > > > > On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > Thx for answer, but in this case where I put the
link?
> > > > > > I have to load this page with this link:
/sort.php/id=5&read=3
>
> > > > > > Then in div1: i can $_GET
[''id''], and in div2 i can $_GET[''read'']
> > > > > > top show my case page.
>
> > > > > > Can you explain me with an ex short code page?
>
> > > > > > On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > Read your question to quick =]
>
> > > > > > > You can do it the unobstrusive way...
>
> > > > > > >
$(''myLink'').observe(''click'', function(ev){
> > > > > > > ev.stop();
> > > > > > > [''id-1'',
''id-2''].each(function(single_id){
> > > > > > > new Ajax.Updater(single_id,
''page.php'', {options});
> > > > > > > });
>
> > > > > > > });
>
> > > > > > > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > > > > > > {options});">Link</a>
>
> > > > > > > > <div id="div-id">Read
the API!</div>
>
> > > > > > > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > Hy, i''ve would like to
know, using protorype.js file, to load a file
> > > > > > > > > in two div with one link...
> > > > > > > > > Is it possibile?
> > > > > > > > > thx...- Nascondi testo tra
virgolette -
>
> > > > > > > - Mostra testo tra virgolette -- Nascondi
testo tra virgolette -
>
> > > > > - Mostra testo tra virgolette -- Nascondi testo tra
virgolette -
>
> - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
If you would want to update a div with multiple variables, you would
have to put it in a different var first if it is something more than
just adding it.
//complex version
var temp = ''<span
class="type">''+json.type+''</span><span
class="date">''+json.date+''</span>'';
$(''div1'').update(temp);
// simple version
$(''div1'').update(json.type + json.date);
the json.* variables are normal javascript vars, so they follow the
same rules.
Remember: The variables you want to use have to be outputted by your
serverside script first!
On 27 nov, 12:05, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> You''re so GREAT!! Now I have what i want... i''ll try it
> soon!
> Thank you very much, but only a question: if i test offline, activex
> block my page,
> it''s true? There is a way?
>
> Then, if I want pass 2 variable, or more, in a div?
>
> $(''div1'').update(json.type&date); ???
> $(''div2'').update(json.date);
>
> Otherelse i think to pass a variable like this: date=22-11-07|
> type=month|id=5
> and then split my string by |
>
> It''s possible?
>
> On 27 Nov, 10:12, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > I made a quick and very basic example for you to make it a bit
> > clearer.http://newmillineon.nl/lab/semolino/
>
> > If you want to take a look at the code and structure, I zipped it all
> > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> > Hope you grab the concept a little bit now... otherwise you might want
> > to take a step back and learn a few things more before you try
> > something like this again.
>
> > Greetz,
>
> > Wizz
>
> > On 27 nov, 01:44, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > I try with:
> > > <a href="#" onclick="new
Ajax.Request(''boxes/project_.php?
> > > type=urbandesign'', {
>
> > > onComplete: function(transport) {
> > > var json = transport.responseJSON;
> > > $(''box'').update(json.type);
> > > $(''box3'').update(json.type);
> > > }
>
> > > }); " >xxx</a>
>
> > > but nothing... can you help me again?
> > > Thx...
>
> > > On 26 Nov, 20:57, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > <html xmlns="http://www.w3.org/1999/xhtml"
lang="it" xml:lang="it">
> > > > <head>
> > > > <meta http-equiv="Content-Type"
content="text/html;
> > > > charset=iso-8859-1" />
>
> > > > <script src="js/prototype.js"
type="text/javascript"></script>
> > > > <body marginwidth="0"
marginheight="0" topmargin="0" bottommargin="0"
> > > > leftmargin="0" rightmargin="0">
> > > > <!-- header //-->
> > > > <?php require(''includes/header.php'');
?>
> > > > <!-- header_eof //-->
>
> > > > <table id="Table_01" width="764"
height="650" border="0"
> > > > cellpadding="0" cellspacing="0"
align="center">
> > > > <tr>
> > > > <td width="764"
height="100%" align="center" valign="top">
> > > > <div id="content"><a
href="boxes/project.php?type=housing">link</a</
> > > > div></td>
>
> > > > <div id="box"></div>
> > > > <div id="box2"></div>
>
> > > > </td>
> > > > </tr>
>
> > > > </table>
> > > > </body>
> > > > </html>
>
> > > > Well, this is my page, how can load my page linked in box
and box2?
> > > > Please, i''ve not understood before...
> > > > On 26 Nov, 17:59, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > <?php
> > > > > header(''Content-type:
application/json'');
> > > > > ?>
> > > > > I put this in the index.php page? This is the page
where a load all
> > > > > div...
>
> > > > > And
> > > > > new Ajax.Request(''url.php'', {
>
> > > > > onComplete: function(transport) {
> > > > > var json = transport.responseJSON;
> > > > > $(''div1'').update(json.id);
> > > > > $(''div2'').update(json.read);
> > > > > }
>
> > > > > });
>
> > > > > Also this code I put in the same page between tag
<script></script>?
> > > > > And the link that call this one?
> > > > > Sorry but it''s first time, and I''ve a
lot of confusion...
>
> > > > > On 26 Nov, 16:55, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > Updating two different target from one result is
not as one target,
> > > > > > but it is possible. A way to accomplish this is to
send back the
> > > > > > result in a JSON format and parse it on the client
side.
>
> > > > > > If you are using PHP on the backend, json_encode
is your friend.
> > > > > > (http://nl3.php.net/manual/nl/ref.json.php)
> > > > > > It can transform arrays and what not into a JSON
format for easy use
> > > > > > by other languages... like javascript.
>
> > > > > > <?php
> > > > > > header(''Content-type:
application/json'');
> > > > > > echo json_encode(array(''id''
=> 364, ''read'' => ''Lorem ipsum''));
> > > > > > ?>
> > > > > > // { ''id'':
''364'', ''read'': ''Lorem
ipsum''}
>
> > > > > > This response is then easily parsed with the
''new'' reponseJSON in the
> > > > > > Ajax class.
>
> > > > > > new Ajax.Request(''url.php'', {
>
> > > > > > onComplete: function(transport) {
> > > > > > var json = transport.responseJSON;
> > > > > > $(''div1'').update(json.id);
> > > > > > $(''div2'').update(json.read);
> > > > > > }
>
> > > > > > });
>
> > > > > > t.responseJSON has been added in version 1.6.0 of
prototype. Keep one
> > > > > > thing in mind though... you HAVE to set the
content type of the
> > > > > > response to "Content-type:
application/json", otherwise prototype will
> > > > > > not recognize it as json.
>
> > > > > > Greetz,
>
> > > > > > Wizz
>
> > > > > > On 26 nov, 14:48, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > Thx for answer, but in this case where I put
the link?
> > > > > > > I have to load this page with this link:
/sort.php/id=5&read=3
>
> > > > > > > Then in div1: i can $_GET
[''id''], and in div2 i can $_GET[''read'']
> > > > > > > top show my case page.
>
> > > > > > > Can you explain me with an ex short code
page?
>
> > > > > > > On 26 Nov, 14:25, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > Read your question to quick =]
>
> > > > > > > > You can do it the unobstrusive way...
>
> > > > > > > >
$(''myLink'').observe(''click'', function(ev){
> > > > > > > > ev.stop();
> > > > > > > > [''id-1'',
''id-2''].each(function(single_id){
> > > > > > > > new Ajax.Updater(single_id,
''page.php'', {options});
> > > > > > > > });
>
> > > > > > > > });
>
> > > > > > > > On 26 nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > <a href="javascript:new
Ajax.Updater(''div-id'', ''page.php'',
> > > > > > > > > {options});">Link</a>
>
> > > > > > > > > <div
id="div-id">Read the API!</div>
>
> > > > > > > > > On 26 nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > Hy, i''ve would like
to know, using protorype.js file, to load a file
> > > > > > > > > > in two div with one link...
> > > > > > > > > > Is it possibile?
> > > > > > > > > > thx...- Nascondi testo tra
virgolette -
>
> > > > > > > > - Mostra testo tra virgolette --
Nascondi testo tra virgolette -
>
> > > > > > - Mostra testo tra virgolette -- Nascondi testo
tra virgolette -
>
> > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I''ve uploaded a slightly modified version to clarify what happens on the serverside. http://newmillineon.nl/lab/semolino/load-two-divs.zip Wizz On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you would want to update a div with multiple variables, you would > have to put it in a different var first if it is something more than > just adding it. > > //complex version > var temp = ''<span class="type">''+json.type+''</span><span > class="date">''+json.date+''</span>''; > $(''div1'').update(temp); > > // simple version > $(''div1'').update(json.type + json.date); > > the json.* variables are normal javascript vars, so they follow the > same rules. > > Remember: The variables you want to use have to be outputted by your > serverside script first! > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You''re so GREAT!! Now I have what i want... i''ll try it > > soon! > > Thank you very much, but only a question: if i test offline, activex > > block my page, > > it''s true? There is a way? > > > Then, if I want pass 2 variable, or more, in a div? > > > $(''div1'').update(json.type&date); ??? > > $(''div2'').update(json.date); > > > Otherelse i think to pass a variable like this: date=22-11-07| > > type=month|id=5 > > and then split my string by | > > > It''s possible? > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I made a quick and very basic example for you to make it a bit > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > If you want to take a look at the code and structure, I zipped it all > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > Hope you grab the concept a little bit now... otherwise you might want > > > to take a step back and learn a few things more before you try > > > something like this again. > > > > Greetz, > > > > Wizz > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I try with: > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > type=urbandesign'', { > > > > > onComplete: function(transport) { > > > > var json = transport.responseJSON; > > > > $(''box'').update(json.type); > > > > $(''box3'').update(json.type); > > > > } > > > > > }); " >xxx</a> > > > > > but nothing... can you help me again? > > > > Thx... > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > <head> > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > charset=iso-8859-1" /> > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > leftmargin="0" rightmargin="0"> > > > > > <!-- header //--> > > > > > <?php require(''includes/header.php''); ?> > > > > > <!-- header_eof //--> > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > <tr> > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > div></td> > > > > > > <div id="box"></div> > > > > > <div id="box2"></div> > > > > > > </td> > > > > > </tr> > > > > > > </table> > > > > > </body> > > > > > </html> > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > Please, i''ve not understood before... > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > <?php > > > > > > header(''Content-type: application/json''); > > > > > > ?> > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > div... > > > > > > > And > > > > > > new Ajax.Request(''url.php'', { > > > > > > > onComplete: function(transport) { > > > > > > var json = transport.responseJSON; > > > > > > $(''div1'').update(json.id); > > > > > > $(''div2'').update(json.read); > > > > > > } > > > > > > > }); > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > And the link that call this one? > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > by other languages... like javascript. > > > > > > > > <?php > > > > > > > header(''Content-type: application/json''); > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > ?> > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > Ajax class. > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > onComplete: function(transport) { > > > > > > > var json = transport.responseJSON; > > > > > > > $(''div1'').update(json.id); > > > > > > > $(''div2'').update(json.read); > > > > > > > } > > > > > > > > }); > > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > > not recognize it as json. > > > > > > > > Greetz, > > > > > > > > Wizz > > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > > top show my case page. > > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > Read your question to quick =] > > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > > ev.stop(); > > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > > }); > > > > > > > > > > }); > > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > > {options});">Link</a> > > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > > in two div with one link... > > > > > > > > > > > Is it possibile? > > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Soon as possibile i''ll try it at home... tank you very much again, but you can confirm me that it''s not possibile test the page offline? On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve uploaded a slightly modified version to clarify what happens on > the serverside. > > http://newmillineon.nl/lab/semolino/load-two-divs.zip > > Wizz > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > If you would want to update a div with multiple variables, you would > > have to put it in a different var first if it is something more than > > just adding it. > > > //complex version > > var temp = ''<span class="type">''+json.type+''</span><span > > class="date">''+json.date+''</span>''; > > $(''div1'').update(temp); > > > // simple version > > $(''div1'').update(json.type + json.date); > > > the json.* variables are normal javascript vars, so they follow the > > same rules. > > > Remember: The variables you want to use have to be outputted by your > > serverside script first! > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > soon! > > > Thank you very much, but only a question: if i test offline, activex > > > block my page, > > > it''s true? There is a way? > > > > Then, if I want pass 2 variable, or more, in a div? > > > > $(''div1'').update(json.type&date); ??? > > > $(''div2'').update(json.date); > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > type=month|id=5 > > > and then split my string by | > > > > It''s possible? > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I made a quick and very basic example for you to make it a bit > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > If you want to take a look at the code and structure, I zipped it all > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > to take a step back and learn a few things more before you try > > > > something like this again. > > > > > Greetz, > > > > > Wizz > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I try with: > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > type=urbandesign'', { > > > > > > onComplete: function(transport) { > > > > > var json = transport.responseJSON; > > > > > $(''box'').update(json.type); > > > > > $(''box3'').update(json.type); > > > > > } > > > > > > }); " >xxx</a> > > > > > > but nothing... can you help me again? > > > > > Thx... > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > <head> > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > charset=iso-8859-1" /> > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > leftmargin="0" rightmargin="0"> > > > > > > <!-- header //--> > > > > > > <?php require(''includes/header.php''); ?> > > > > > > <!-- header_eof //--> > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > <tr> > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > div></td> > > > > > > > <div id="box"></div> > > > > > > <div id="box2"></div> > > > > > > > </td> > > > > > > </tr> > > > > > > > </table> > > > > > > </body> > > > > > > </html> > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > Please, i''ve not understood before... > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > <?php > > > > > > > header(''Content-type: application/json''); > > > > > > > ?> > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > div... > > > > > > > > And > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > onComplete: function(transport) { > > > > > > > var json = transport.responseJSON; > > > > > > > $(''div1'').update(json.id); > > > > > > > $(''div2'').update(json.read); > > > > > > > } > > > > > > > > }); > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > And the link that call this one? > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > by other languages... like javascript. > > > > > > > > > <?php > > > > > > > > header(''Content-type: application/json''); > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > > ?> > > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > > Ajax class. > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > onComplete: function(transport) { > > > > > > > > var json = transport.responseJSON; > > > > > > > > $(''div1'').update(json.id); > > > > > > > > $(''div2'').update(json.read); > > > > > > > > } > > > > > > > > > }); > > > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > > > not recognize it as json. > > > > > > > > > Greetz, > > > > > > > > > Wizz > > > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > > > top show my case page. > > > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Read your question to quick =] > > > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > > > ev.stop(); > > > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > > > }); > > > > > > > > > > > }); > > > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > > > {options});">Link</a> > > > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > > > in two div with one link... > > > > > > > > > > > > Is it possibile? > > > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I tested it on my localhost... you''ll need an apache server with PHP running. wizz On 27 nov, 14:22, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Soon as possibile i''ll try it at home... tank you very much again, but > you can confirm me that it''s not possibile test the page offline? > > On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''ve uploaded a slightly modified version to clarify what happens on > > the serverside. > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > Wizz > > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > If you would want to update a div with multiple variables, you would > > > have to put it in a different var first if it is something more than > > > just adding it. > > > > //complex version > > > var temp = ''<span class="type">''+json.type+''</span><span > > > class="date">''+json.date+''</span>''; > > > $(''div1'').update(temp); > > > > // simple version > > > $(''div1'').update(json.type + json.date); > > > > the json.* variables are normal javascript vars, so they follow the > > > same rules. > > > > Remember: The variables you want to use have to be outputted by your > > > serverside script first! > > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > > soon! > > > > Thank you very much, but only a question: if i test offline, activex > > > > block my page, > > > > it''s true? There is a way? > > > > > Then, if I want pass 2 variable, or more, in a div? > > > > > $(''div1'').update(json.type&date); ??? > > > > $(''div2'').update(json.date); > > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > > type=month|id=5 > > > > and then split my string by | > > > > > It''s possible? > > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I made a quick and very basic example for you to make it a bit > > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > > If you want to take a look at the code and structure, I zipped it all > > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > > to take a step back and learn a few things more before you try > > > > > something like this again. > > > > > > Greetz, > > > > > > Wizz > > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I try with: > > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > > type=urbandesign'', { > > > > > > > onComplete: function(transport) { > > > > > > var json = transport.responseJSON; > > > > > > $(''box'').update(json.type); > > > > > > $(''box3'').update(json.type); > > > > > > } > > > > > > > }); " >xxx</a> > > > > > > > but nothing... can you help me again? > > > > > > Thx... > > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > > <head> > > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > > charset=iso-8859-1" /> > > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > > leftmargin="0" rightmargin="0"> > > > > > > > <!-- header //--> > > > > > > > <?php require(''includes/header.php''); ?> > > > > > > > <!-- header_eof //--> > > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > > <tr> > > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > > div></td> > > > > > > > > <div id="box"></div> > > > > > > > <div id="box2"></div> > > > > > > > > </td> > > > > > > > </tr> > > > > > > > > </table> > > > > > > > </body> > > > > > > > </html> > > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > > Please, i''ve not understood before... > > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > <?php > > > > > > > > header(''Content-type: application/json''); > > > > > > > > ?> > > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > > div... > > > > > > > > > And > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > onComplete: function(transport) { > > > > > > > > var json = transport.responseJSON; > > > > > > > > $(''div1'').update(json.id); > > > > > > > > $(''div2'').update(json.read); > > > > > > > > } > > > > > > > > > }); > > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > > And the link that call this one? > > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > > by other languages... like javascript. > > > > > > > > > > <?php > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > > > ?> > > > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > > > Ajax class. > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > } > > > > > > > > > > }); > > > > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > > > > not recognize it as json. > > > > > > > > > > Greetz, > > > > > > > > > > Wizz > > > > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > > > > top show my case page. > > > > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Read your question to quick =] > > > > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > > > > ev.stop(); > > > > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > > > > }); > > > > > > > > > > > > }); > > > > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > > > > {options});">Link</a> > > > > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > > > > in two div with one link... > > > > > > > > > > > > > Is it possibile? > > > > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Mh.. strange because i work with mac, that have apache and php inside... i''ll try again... when i go on localhost, the browers ask me if i want save the page... i''ll tell you later. tnx On 27 Nov, 14:28, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I tested it on my localhost... you''ll need an apache server with PHP > running. > > wizz > > On 27 nov, 14:22, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Soon as possibile i''ll try it at home... tank you very much again, but > > you can confirm me that it''s not possibile test the page offline? > > > On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''ve uploaded a slightly modified version to clarify what happens on > > > the serverside. > > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > Wizz > > > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > If you would want to update a div with multiple variables, you would > > > > have to put it in a different var first if it is something more than > > > > just adding it. > > > > > //complex version > > > > var temp = ''<span class="type">''+json.type+''</span><span > > > > class="date">''+json.date+''</span>''; > > > > $(''div1'').update(temp); > > > > > // simple version > > > > $(''div1'').update(json.type + json.date); > > > > > the json.* variables are normal javascript vars, so they follow the > > > > same rules. > > > > > Remember: The variables you want to use have to be outputted by your > > > > serverside script first! > > > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > > > soon! > > > > > Thank you very much, but only a question: if i test offline, activex > > > > > block my page, > > > > > it''s true? There is a way? > > > > > > Then, if I want pass 2 variable, or more, in a div? > > > > > > $(''div1'').update(json.type&date); ??? > > > > > $(''div2'').update(json.date); > > > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > > > type=month|id=5 > > > > > and then split my string by | > > > > > > It''s possible? > > > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I made a quick and very basic example for you to make it a bit > > > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > > > If you want to take a look at the code and structure, I zipped it all > > > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > > > to take a step back and learn a few things more before you try > > > > > > something like this again. > > > > > > > Greetz, > > > > > > > Wizz > > > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I try with: > > > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > > > type=urbandesign'', { > > > > > > > > onComplete: function(transport) { > > > > > > > var json = transport.responseJSON; > > > > > > > $(''box'').update(json.type); > > > > > > > $(''box3'').update(json.type); > > > > > > > } > > > > > > > > }); " >xxx</a> > > > > > > > > but nothing... can you help me again? > > > > > > > Thx... > > > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > > > <head> > > > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > > > charset=iso-8859-1" /> > > > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > > > leftmargin="0" rightmargin="0"> > > > > > > > > <!-- header //--> > > > > > > > > <?php require(''includes/header.php''); ?> > > > > > > > > <!-- header_eof //--> > > > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > > > <tr> > > > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > > > div></td> > > > > > > > > > <div id="box"></div> > > > > > > > > <div id="box2"></div> > > > > > > > > > </td> > > > > > > > > </tr> > > > > > > > > > </table> > > > > > > > > </body> > > > > > > > > </html> > > > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > > > Please, i''ve not understood before... > > > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > <?php > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > ?> > > > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > > > div... > > > > > > > > > > And > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > } > > > > > > > > > > }); > > > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > > > And the link that call this one? > > > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > > > by other languages... like javascript. > > > > > > > > > > > <?php > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > > > > ?> > > > > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > > > > Ajax class. > > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > } > > > > > > > > > > > }); > > > > > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > > > > > not recognize it as json. > > > > > > > > > > > Greetz, > > > > > > > > > > > Wizz > > > > > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > > > > > top show my case page. > > > > > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > Read your question to quick =] > > > > > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > > > > > ev.stop(); > > > > > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > > > > > }); > > > > > > > > > > > > > }); > > > > > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > > > > > {options});">Link</a> > > > > > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > > > > > in two div with one link... > > > > > > > > > > > > > > Is it possibile? > > > > > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I don''t have a Mac I can test this on, but I just tested it in Safari for windows and it works like it''s supposed to... remember that you have to access the ''index.html'' file and not the php- script that generates the data. Wizz On 27 nov, 15:53, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Mh.. strange because i work with mac, that have apache and php > inside... > i''ll try again... when i go on localhost, the browers ask me if i want > save the page... i''ll tell you later. > tnx > > On 27 Nov, 14:28, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I tested it on my localhost... you''ll need an apache server with PHP > > running. > > > wizz > > > On 27 nov, 14:22, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Soon as possibile i''ll try it at home... tank you very much again, but > > > you can confirm me that it''s not possibile test the page offline? > > > > On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''ve uploaded a slightly modified version to clarify what happens on > > > > the serverside. > > > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > Wizz > > > > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > If you would want to update a div with multiple variables, you would > > > > > have to put it in a different var first if it is something more than > > > > > just adding it. > > > > > > //complex version > > > > > var temp = ''<span class="type">''+json.type+''</span><span > > > > > class="date">''+json.date+''</span>''; > > > > > $(''div1'').update(temp); > > > > > > // simple version > > > > > $(''div1'').update(json.type + json.date); > > > > > > the json.* variables are normal javascript vars, so they follow the > > > > > same rules. > > > > > > Remember: The variables you want to use have to be outputted by your > > > > > serverside script first! > > > > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > > > > soon! > > > > > > Thank you very much, but only a question: if i test offline, activex > > > > > > block my page, > > > > > > it''s true? There is a way? > > > > > > > Then, if I want pass 2 variable, or more, in a div? > > > > > > > $(''div1'').update(json.type&date); ??? > > > > > > $(''div2'').update(json.date); > > > > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > > > > type=month|id=5 > > > > > > and then split my string by | > > > > > > > It''s possible? > > > > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I made a quick and very basic example for you to make it a bit > > > > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > > > > If you want to take a look at the code and structure, I zipped it all > > > > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > > > > to take a step back and learn a few things more before you try > > > > > > > something like this again. > > > > > > > > Greetz, > > > > > > > > Wizz > > > > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I try with: > > > > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > > > > type=urbandesign'', { > > > > > > > > > onComplete: function(transport) { > > > > > > > > var json = transport.responseJSON; > > > > > > > > $(''box'').update(json.type); > > > > > > > > $(''box3'').update(json.type); > > > > > > > > } > > > > > > > > > }); " >xxx</a> > > > > > > > > > but nothing... can you help me again? > > > > > > > > Thx... > > > > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > > > > <head> > > > > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > > > > charset=iso-8859-1" /> > > > > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > > > > leftmargin="0" rightmargin="0"> > > > > > > > > > <!-- header //--> > > > > > > > > > <?php require(''includes/header.php''); ?> > > > > > > > > > <!-- header_eof //--> > > > > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > > > > <tr> > > > > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > > > > div></td> > > > > > > > > > > <div id="box"></div> > > > > > > > > > <div id="box2"></div> > > > > > > > > > > </td> > > > > > > > > > </tr> > > > > > > > > > > </table> > > > > > > > > > </body> > > > > > > > > > </html> > > > > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > > > > Please, i''ve not understood before... > > > > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > <?php > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > ?> > > > > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > > > > div... > > > > > > > > > > > And > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > } > > > > > > > > > > > }); > > > > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > > > > And the link that call this one? > > > > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > > > > by other languages... like javascript. > > > > > > > > > > > > <?php > > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > > > > > ?> > > > > > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > > > > > Ajax class. > > > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > > } > > > > > > > > > > > > }); > > > > > > > > > > > > t.responseJSON has been added in version 1.6.0 of prototype. Keep one > > > > > > > > > > > thing in mind though... you HAVE to set the content type of the > > > > > > > > > > > response to "Content-type: application/json", otherwise prototype will > > > > > > > > > > > not recognize it as json. > > > > > > > > > > > > Greetz, > > > > > > > > > > > > Wizz > > > > > > > > > > > > On 26 nov, 14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > Thx for answer, but in this case where I put the link? > > > > > > > > > > > > I have to load this page with this link: /sort.php/id=5&read=3 > > > > > > > > > > > > > Then in div1: i can $_GET [''id''], and in div2 i can $_GET[''read''] > > > > > > > > > > > > top show my case page. > > > > > > > > > > > > > Can you explain me with an ex short code page? > > > > > > > > > > > > > On 26 Nov, 14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > Read your question to quick =] > > > > > > > > > > > > > > You can do it the unobstrusive way... > > > > > > > > > > > > > > $(''myLink'').observe(''click'', function(ev){ > > > > > > > > > > > > > ev.stop(); > > > > > > > > > > > > > [''id-1'', ''id-2''].each(function(single_id){ > > > > > > > > > > > > > new Ajax.Updater(single_id, ''page.php'', {options}); > > > > > > > > > > > > > }); > > > > > > > > > > > > > > }); > > > > > > > > > > > > > > On 26 nov, 14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > <a href="javascript:new Ajax.Updater(''div-id'', ''page.php'', > > > > > > > > > > > > > > {options});">Link</a> > > > > > > > > > > > > > > > <div id="div-id">Read the API!</div> > > > > > > > > > > > > > > > On 26 nov, 13:55, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > > Hy, i''ve would like to know, using protorype.js file, to load a file > > > > > > > > > > > > > > > in two div with one link... > > > > > > > > > > > > > > > Is it possibile? > > > > > > > > > > > > > > > thx...- Nascondi testo tra virgolette - > > > > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > > > - Mostra testo tra virgolette -- Nascondi testo tra virgolette - > > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I can''t test in localhost :(
But while i''m working, in the page that you''ve named
content.php
can I receive and manipulate data like this way?
header(''Content-type: application/json'');
switch ($_GET[''type'']) {
case "0" :
echo "hallo div1";
break;
case "1" :
echo "goodbye div1";
break;
}
switch ($_GET[''type2'']) {
case "0" :
echo "hallo div1";
break;
}
case "1" :
echo "goodbye div2";
break;
...
So i''ll could have two different result in two different div.
Or I must use only echo json_encode($arr);?
On 27 Nov, 16:01, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I don''t have a Mac I can test this on, but I just tested it in
Safari
> for windows and it works like it''s supposed to...
>
> remember that you have to access the ''index.html'' file
and not the php-
> script that generates the data.
>
> Wizz
>
> On 27 nov, 15:53, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Mh.. strange because i work with mac, that have apache and php
> > inside...
> > i''ll try again... when i go on localhost, the browers ask me
if i want
> > save the page... i''ll tell you later.
> > tnx
>
> > On 27 Nov, 14:28, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > I tested it on my localhost... you''ll need an apache
server with PHP
> > > running.
>
> > > wizz
>
> > > On 27 nov, 14:22, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > Soon as possibile i''ll try it at home... tank you
very much again, but
> > > > you can confirm me that it''s not possibile test the
page offline?
>
> > > > On 27 Nov, 12:47, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > I''ve uploaded a slightly modified version to
clarify what happens on
> > > > > the serverside.
>
> > > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> > > > > Wizz
>
> > > > > On 27 nov, 12:41, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > If you would want to update a div with multiple
variables, you would
> > > > > > have to put it in a different var first if it is
something more than
> > > > > > just adding it.
>
> > > > > > //complex version
> > > > > > var temp = ''<span
class="type">''+json.type+''</span><span
> > > > > >
class="date">''+json.date+''</span>'';
> > > > > > $(''div1'').update(temp);
>
> > > > > > // simple version
> > > > > > $(''div1'').update(json.type +
json.date);
>
> > > > > > the json.* variables are normal javascript vars,
so they follow the
> > > > > > same rules.
>
> > > > > > Remember: The variables you want to use have to be
outputted by your
> > > > > > serverside script first!
>
> > > > > > On 27 nov, 12:05, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > You''re so GREAT!! Now I have what i
want... i''ll try it
> > > > > > > soon!
> > > > > > > Thank you very much, but only a question: if
i test offline, activex
> > > > > > > block my page,
> > > > > > > it''s true? There is a way?
>
> > > > > > > Then, if I want pass 2 variable, or more, in
a div?
>
> > > > > > >
$(''div1'').update(json.type&date); ???
> > > > > > >
$(''div2'').update(json.date);
>
> > > > > > > Otherelse i think to pass a variable like
this: date=22-11-07|
> > > > > > > type=month|id=5
> > > > > > > and then split my string by |
>
> > > > > > > It''s possible?
>
> > > > > > > On 27 Nov, 10:12, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > I made a quick and very basic example
for you to make it a bit
> > > > > > > >
clearer.http://newmillineon.nl/lab/semolino/
>
> > > > > > > > If you want to take a look at the code
and structure, I zipped it all
> > > > > > > > up for
you.http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> > > > > > > > Hope you grab the concept a little bit
now... otherwise you might want
> > > > > > > > to take a step back and learn a few
things more before you try
> > > > > > > > something like this again.
>
> > > > > > > > Greetz,
>
> > > > > > > > Wizz
>
> > > > > > > > On 27 nov, 01:44, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > I try with:
> > > > > > > > > <a href="#"
onclick="new Ajax.Request(''boxes/project_.php?
> > > > > > > > > type=urbandesign'', {
>
> > > > > > > > > onComplete: function(transport) {
> > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > >
$(''box'').update(json.type);
> > > > > > > > >
$(''box3'').update(json.type);
> > > > > > > > > }
>
> > > > > > > > > }); " >xxx</a>
>
> > > > > > > > > but nothing... can you help me
again?
> > > > > > > > > Thx...
>
> > > > > > > > > On 26 Nov, 20:57, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > <html
xmlns="http://www.w3.org/1999/xhtml" lang="it"
xml:lang="it">
> > > > > > > > > > <head>
> > > > > > > > > > <meta
http-equiv="Content-Type" content="text/html;
> > > > > > > > > > charset=iso-8859-1" />
>
> > > > > > > > > > <script
src="js/prototype.js"
type="text/javascript"></script>
> > > > > > > > > > <body
marginwidth="0" marginheight="0" topmargin="0"
bottommargin="0"
> > > > > > > > > > leftmargin="0"
rightmargin="0">
> > > > > > > > > > <!-- header //-->
> > > > > > > > > > <?php
require(''includes/header.php''); ?>
> > > > > > > > > > <!-- header_eof //-->
>
> > > > > > > > > > <table
id="Table_01" width="764" height="650"
border="0"
> > > > > > > > > > cellpadding="0"
cellspacing="0" align="center">
> > > > > > > > > > <tr>
> > > > > > > > > > <td
width="764" height="100%" align="center"
valign="top">
> > > > > > > > > > <div
id="content"><a
href="boxes/project.php?type=housing">link</a</
> > > > > > > > > > div></td>
>
> > > > > > > > > > <div
id="box"></div>
> > > > > > > > > > <div
id="box2"></div>
>
> > > > > > > > > > </td>
> > > > > > > > > > </tr>
>
> > > > > > > > > > </table>
> > > > > > > > > > </body>
> > > > > > > > > > </html>
>
> > > > > > > > > > Well, this is my page, how can
load my page linked in box and box2?
> > > > > > > > > > Please, i''ve not
understood before...
> > > > > > > > > > On 26 Nov, 17:59, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > <?php
> > > > > > > > > > >
header(''Content-type: application/json'');
> > > > > > > > > > > ?>
> > > > > > > > > > > I put this in the
index.php page? This is the page where a load all
> > > > > > > > > > > div...
>
> > > > > > > > > > > And
> > > > > > > > > > > new
Ajax.Request(''url.php'', {
>
> > > > > > > > > > > onComplete:
function(transport) {
> > > > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > > > >
$(''div1'').update(json.id);
> > > > > > > > > > >
$(''div2'').update(json.read);
> > > > > > > > > > > }
>
> > > > > > > > > > > });
>
> > > > > > > > > > > Also this code I put in
the same page between tag <script></script>?
> > > > > > > > > > > And the link that call
this one?
> > > > > > > > > > > Sorry but it''s
first time, and I''ve a lot of confusion...
>
> > > > > > > > > > > On 26 Nov, 16:55, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > Updating two
different target from one result is not as one target,
> > > > > > > > > > > > but it is possible.
A way to accomplish this is to send back the
> > > > > > > > > > > > result in a JSON
format and parse it on the client side.
>
> > > > > > > > > > > > If you are using PHP
on the backend, json_encode is your friend.
> > > > > > > > > > > >
(http://nl3.php.net/manual/nl/ref.json.php)
> > > > > > > > > > > > It can transform
arrays and what not into a JSON format for easy use
> > > > > > > > > > > > by other
languages... like javascript.
>
> > > > > > > > > > > > <?php
> > > > > > > > > > > >
header(''Content-type: application/json'');
> > > > > > > > > > > > echo
json_encode(array(''id'' => 364, ''read''
=> ''Lorem ipsum''));
> > > > > > > > > > > > ?>
> > > > > > > > > > > > // {
''id'': ''364'', ''read'':
''Lorem ipsum''}
>
> > > > > > > > > > > > This response is
then easily parsed with the ''new'' reponseJSON in the
> > > > > > > > > > > > Ajax class.
>
> > > > > > > > > > > > new
Ajax.Request(''url.php'', {
>
> > > > > > > > > > > > onComplete:
function(transport) {
> > > > > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > > > > >
$(''div1'').update(json.id);
> > > > > > > > > > > >
$(''div2'').update(json.read);
> > > > > > > > > > > > }
>
> > > > > > > > > > > > });
>
> > > > > > > > > > > > t.responseJSON has
been added in version 1.6.0 of prototype. Keep one
> > > > > > > > > > > > thing in mind
though... you HAVE to set the content type of the
> > > > > > > > > > > > response to
"Content-type: application/json", otherwise prototype will
> > > > > > > > > > > > not recognize it as
json.
>
> > > > > > > > > > > > Greetz,
>
> > > > > > > > > > > > Wizz
>
> > > > > > > > > > > > On 26 nov, 14:48,
semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > > Thx for answer,
but in this case where I put the link?
> > > > > > > > > > > > > I have to load
this page with this link: /sort.php/id=5&read=3
>
> > > > > > > > > > > > > Then in div1: i
can $_GET [''id''], and in div2 i can
$_GET[''read'']
> > > > > > > > > > > > > top show my
case page.
>
> > > > > > > > > > > > > Can you explain
me with an ex short code page?
>
> > > > > > > > > > > > > On 26 Nov,
14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> > > > > > > > > > > > > > Read your
question to quick =]
>
> > > > > > > > > > > > > > You can do
it the unobstrusive way...
>
> > > > > > > > > > > > > >
$(''myLink'').observe(''click'', function(ev){
> > > > > > > > > > > > > >
ev.stop();
> > > > > > > > > > > > > >
[''id-1'', ''id-2''].each(function(single_id){
> > > > > > > > > > > > > >
new Ajax.Updater(single_id, ''page.php'', {options});
> > > > > > > > > > > > > > });
>
> > > > > > > > > > > > > > });
>
> > > > > > > > > > > > > > On 26 nov,
14:22, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> > > > > > > > > > > > > > > <a
href="javascript:new Ajax.Updater(''div-id'',
''page.php'',
> > > > > > > > > > > > > > >
{options});">Link</a>
>
> > > > > > > > > > > > > > >
<div id="div-id">Read the API!</div>
>
> > > > > > > > > > > > > > > On 26
nov, 13:55, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > > > > >
Hy, i''ve would like to know, using protorype.js file, to load a file
> > > > > > > > > > > > > > > >
in two div with one link...
> > > > > > > > > > > > > > > >
Is it possibile?
> > > > > > > > > > > > > > > >
thx...- Nascondi testo tra virgolette -
>
> > > > > > > > > > > > > > - Mostra
testo tra virgolette -- Nascondi testo tra virgolette -
>
> > > > > > > > > > > > - Mostra testo tra
virgolette -- Nascondi testo tra virgolette -
>
> > > > > > > > - Mostra testo tra virgolette --
Nascondi testo tra virgolette -
>
> > > > > - Mostra testo tra virgolette -- Nascondi testo tra
virgolette -
>
> > > - Mostra testo tra virgolette -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
You can have thousands of different results.. But I get the idea that
you don''t fully grasp the concept of $_GET and $_POST variables in
php...
Get and post variables are what the server receives as input... not as
output.
for example: "content.php?type=hello&type2=world"
// this would give you access to the following vars
<?php
$_GET[''type'']; // == hello
$_GET[''type2'']; // == world
?>
the purpose of the json_encode is to output in a valid JSON format.
Json is nothing else thena simpel string, but a lot of different
scripting languages know how to interpret this string and turn it into
an object.
<?php
$var = ''hello'';
$var2 = ''world'';
$output = array(
''var'' => $var,
''var2'' => $var2
);
echo json_encode($output); // = { ''var'' :
''hello'', ''var2'' :
''world'' }
?>
I really think you should start by reading up on your PHP skills and
doing some tutorials, ''cause you seem to lack some familiarity with
the logic behind it.
Wizz
As $var and $var2 are variables, you can assign any value to them that
you want to return.
On 27 nov, 18:56, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I can''t test in localhost :(
> But while i''m working, in the page that you''ve named
content.php
> can I receive and manipulate data like this way?
>
> header(''Content-type: application/json'');
> switch ($_GET[''type'']) {
> case "0" :
> echo "hallo div1";
> break;
> case "1" :
> echo "goodbye div1";
> break;}
>
> switch ($_GET[''type2'']) {
> case "0" :
> echo "hallo div1";
> break;}
>
> case "1" :
> echo "goodbye div2";
> break;
> ...
>
> So i''ll could have two different result in two different div.
> Or I must use only echo json_encode($arr);?
>
> On 27 Nov, 16:01, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > I don''t have a Mac I can test this on, but I just tested it
in Safari
> > for windows and it works like it''s supposed to...
>
> > remember that you have to access the ''index.html''
file and not the php-
> > script that generates the data.
>
> > Wizz
>
> > On 27 nov, 15:53, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Mh.. strange because i work with mac, that have apache and php
> > > inside...
> > > i''ll try again... when i go on localhost, the browers
ask me if i want
> > > save the page... i''ll tell you later.
> > > tnx
>
> > > On 27 Nov, 14:28, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > I tested it on my localhost... you''ll need an
apache server with PHP
> > > > running.
>
> > > > wizz
>
> > > > On 27 nov, 14:22, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > Soon as possibile i''ll try it at home... tank
you very much again, but
> > > > > you can confirm me that it''s not possibile
test the page offline?
>
> > > > > On 27 Nov, 12:47, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > I''ve uploaded a slightly modified version
to clarify what happens on
> > > > > > the serverside.
>
> > > > >
>http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> > > > > > Wizz
>
> > > > > > On 27 nov, 12:41, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > If you would want to update a div with
multiple variables, you would
> > > > > > > have to put it in a different var first if it
is something more than
> > > > > > > just adding it.
>
> > > > > > > //complex version
> > > > > > > var temp = ''<span
class="type">''+json.type+''</span><span
> > > > > > >
class="date">''+json.date+''</span>'';
> > > > > > > $(''div1'').update(temp);
>
> > > > > > > // simple version
> > > > > > > $(''div1'').update(json.type
+ json.date);
>
> > > > > > > the json.* variables are normal javascript
vars, so they follow the
> > > > > > > same rules.
>
> > > > > > > Remember: The variables you want to use have
to be outputted by your
> > > > > > > serverside script first!
>
> > > > > > > On 27 nov, 12:05, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > You''re so GREAT!! Now I have
what i want... i''ll try it
> > > > > > > > soon!
> > > > > > > > Thank you very much, but only a
question: if i test offline, activex
> > > > > > > > block my page,
> > > > > > > > it''s true? There is a way?
>
> > > > > > > > Then, if I want pass 2 variable, or
more, in a div?
>
> > > > > > > >
$(''div1'').update(json.type&date); ???
> > > > > > > >
$(''div2'').update(json.date);
>
> > > > > > > > Otherelse i think to pass a variable
like this: date=22-11-07|
> > > > > > > > type=month|id=5
> > > > > > > > and then split my string by |
>
> > > > > > > > It''s possible?
>
> > > > > > > > On 27 Nov, 10:12, Wizz
<woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > I made a quick and very basic
example for you to make it a bit
> > > > > > > > >
clearer.http://newmillineon.nl/lab/semolino/
>
> > > > > > > > > If you want to take a look at the
code and structure, I zipped it all
> > > > > > > > > up for
you.http://newmillineon.nl/lab/semolino/load-two-divs.zip
>
> > > > > > > > > Hope you grab the concept a little
bit now... otherwise you might want
> > > > > > > > > to take a step back and learn a few
things more before you try
> > > > > > > > > something like this again.
>
> > > > > > > > > Greetz,
>
> > > > > > > > > Wizz
>
> > > > > > > > > On 27 nov, 01:44, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > I try with:
> > > > > > > > > > <a href="#"
onclick="new Ajax.Request(''boxes/project_.php?
> > > > > > > > > > type=urbandesign'', {
>
> > > > > > > > > > onComplete:
function(transport) {
> > > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > > >
$(''box'').update(json.type);
> > > > > > > > > >
$(''box3'').update(json.type);
> > > > > > > > > > }
>
> > > > > > > > > > }); " >xxx</a>
>
> > > > > > > > > > but nothing... can you help me
again?
> > > > > > > > > > Thx...
>
> > > > > > > > > > On 26 Nov, 20:57, semolino
<simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > <html
xmlns="http://www.w3.org/1999/xhtml" lang="it"
xml:lang="it">
> > > > > > > > > > > <head>
> > > > > > > > > > > <meta
http-equiv="Content-Type" content="text/html;
> > > > > > > > > > > charset=iso-8859-1"
/>
>
> > > > > > > > > > > <script
src="js/prototype.js"
type="text/javascript"></script>
> > > > > > > > > > > <body
marginwidth="0" marginheight="0" topmargin="0"
bottommargin="0"
> > > > > > > > > > > leftmargin="0"
rightmargin="0">
> > > > > > > > > > > <!-- header //-->
> > > > > > > > > > > <?php
require(''includes/header.php''); ?>
> > > > > > > > > > > <!-- header_eof
//-->
>
> > > > > > > > > > > <table
id="Table_01" width="764" height="650"
border="0"
> > > > > > > > > > > cellpadding="0"
cellspacing="0" align="center">
> > > > > > > > > > > <tr>
> > > > > > > > > > > <td
width="764" height="100%" align="center"
valign="top">
> > > > > > > > > > > <div
id="content"><a
href="boxes/project.php?type=housing">link</a</
> > > > > > > > > > > div></td>
>
> > > > > > > > > > > <div
id="box"></div>
> > > > > > > > > > > <div
id="box2"></div>
>
> > > > > > > > > > > </td>
> > > > > > > > > > > </tr>
>
> > > > > > > > > > > </table>
> > > > > > > > > > > </body>
> > > > > > > > > > > </html>
>
> > > > > > > > > > > Well, this is my page,
how can load my page linked in box and box2?
> > > > > > > > > > > Please, i''ve not
understood before...
> > > > > > > > > > > On 26 Nov, 17:59,
semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > <?php
> > > > > > > > > > > >
header(''Content-type: application/json'');
> > > > > > > > > > > > ?>
> > > > > > > > > > > > I put this in the
index.php page? This is the page where a load all
> > > > > > > > > > > > div...
>
> > > > > > > > > > > > And
> > > > > > > > > > > > new
Ajax.Request(''url.php'', {
>
> > > > > > > > > > > > onComplete:
function(transport) {
> > > > > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > > > > >
$(''div1'').update(json.id);
> > > > > > > > > > > >
$(''div2'').update(json.read);
> > > > > > > > > > > > }
>
> > > > > > > > > > > > });
>
> > > > > > > > > > > > Also this code I put
in the same page between tag <script></script>?
> > > > > > > > > > > > And the link that
call this one?
> > > > > > > > > > > > Sorry but
it''s first time, and I''ve a lot of confusion...
>
> > > > > > > > > > > > On 26 Nov, 16:55,
Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > > Updating two
different target from one result is not as one target,
> > > > > > > > > > > > > but it is
possible. A way to accomplish this is to send back the
> > > > > > > > > > > > > result in a
JSON format and parse it on the client side.
>
> > > > > > > > > > > > > If you are
using PHP on the backend, json_encode is your friend.
> > > > > > > > > > > > >
(http://nl3.php.net/manual/nl/ref.json.php)
> > > > > > > > > > > > > It can
transform arrays and what not into a JSON format for easy use
> > > > > > > > > > > > > by other
languages... like javascript.
>
> > > > > > > > > > > > > <?php
> > > > > > > > > > > > >
header(''Content-type: application/json'');
> > > > > > > > > > > > > echo
json_encode(array(''id'' => 364, ''read''
=> ''Lorem ipsum''));
> > > > > > > > > > > > > ?>
> > > > > > > > > > > > > // {
''id'': ''364'', ''read'':
''Lorem ipsum''}
>
> > > > > > > > > > > > > This response
is then easily parsed with the ''new'' reponseJSON in the
> > > > > > > > > > > > > Ajax class.
>
> > > > > > > > > > > > > new
Ajax.Request(''url.php'', {
>
> > > > > > > > > > > > > onComplete:
function(transport) {
> > > > > > > > > > > > > var json =
transport.responseJSON;
> > > > > > > > > > > > >
$(''div1'').update(json.id);
> > > > > > > > > > > > >
$(''div2'').update(json.read);
> > > > > > > > > > > > > }
>
> > > > > > > > > > > > > });
>
> > > > > > > > > > > > > t.responseJSON
has been added in version 1.6.0 of prototype. Keep one
> > > > > > > > > > > > > thing in mind
though... you HAVE to set the content type of the
> > > > > > > > > > > > > response to
"Content-type: application/json", otherwise prototype will
> > > > > > > > > > > > > not recognize
it as json.
>
> > > > > > > > > > > > > Greetz,
>
> > > > > > > > > > > > > Wizz
>
> > > > > > > > > > > > > On 26 nov,
14:48, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> > > > > > > > > > > > > > Thx for
answer, but in this case where I put the link?
> > > > > > > > > > > > > > I have to
load this page with this link: /sort.php/id=5&read=3
>
> > > > > > > > > > > > > > Then in
div1: i can $_GET [''id''], and in div2 i can
$_GET[''read'']
> > > > > > > > > > > > > > top show
my case page.
>
> > > > > > > > > > > > > > Can you
explain me with an ex short code page?
>
> > > > > > > > > > > > > > On 26 Nov,
14:25, Roland <franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> > > > > > > > > > > > > > > Read
your question to quick =]
>
> > > > > > > > > > > > > > > You
can do it the unobstrusive way...
>
> > > > > > > > > > > > > > >
$(''myLink'').observe(''click'', function(ev){
> > > > > > > > > > > > > > >
ev.stop();
> > > > > > > > > > > > > > >
[''id-1'', ''id-2''].each(function(single_id){
> > > > > > > > > > > > > > >
new Ajax.Updater(single_id, ''page.php'', {options});
> > > > > > > > > > > > > > >
});
>
> > > > > > > > > > > > > > > });
>
> > > > > > > > > > > > > > > On 26
nov, 14:22, Roland
<franssen.rol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > > > > > > > > > > > >
<a
>
> ...
>
> meer lezen >>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I know PHP and POST or GET method, is a lot of years that I work with, but I ask only if I must use the json_encode string to have result... I must put the page online to testing... i''ll tell you later... thx On 27 Nov, 23:56, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You can have thousands of different results.. But I get the idea that > you don''t fully grasp the concept of $_GET and $_POST variables in > php... > > Get and post variables are what the server receives as input... not as > output. > > for example: "content.php?type=hello&type2=world" > // this would give you access to the following vars > <?php > $_GET[''type'']; // == hello > $_GET[''type2'']; // == world > ?> > > the purpose of the json_encode is to output in a valid JSON format. > Json is nothing else thena simpel string, but a lot of different > scripting languages know how to interpret this string and turn it into > an object. > > <?php > $var = ''hello''; > $var2 = ''world''; > $output = array( > ''var'' => $var, > ''var2'' => $var2 > ); > > echo json_encode($output); // = { ''var'' : ''hello'', ''var2'' : > ''world'' } > ?> > > I really think you should start by reading up on your PHP skills and > doing some tutorials, ''cause you seem to lack some familiarity with > the logic behind it. > > Wizz > > As $var and $var2 are variables, you can assign any value to them that > you want to return. > On 27 nov, 18:56, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I can''t test in localhost :( > > But while i''m working, in the page that you''ve named content.php > > can I receive and manipulate data like this way? > > > header(''Content-type: application/json''); > > switch ($_GET[''type'']) { > > case "0" : > > echo "hallo div1"; > > break; > > case "1" : > > echo "goodbye div1"; > > break;} > > > switch ($_GET[''type2'']) { > > case "0" : > > echo "hallo div1"; > > break;} > > > case "1" : > > echo "goodbye div2"; > > break; > > ... > > > So i''ll could have two different result in two different div. > > Or I must use only echo json_encode($arr);? > > > On 27 Nov, 16:01, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I don''t have a Mac I can test this on, but I just tested it in Safari > > > for windows and it works like it''s supposed to... > > > > remember that you have to access the ''index.html'' file and not the php- > > > script that generates the data. > > > > Wizz > > > > On 27 nov, 15:53, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Mh.. strange because i work with mac, that have apache and php > > > > inside... > > > > i''ll try again... when i go on localhost, the browers ask me if i want > > > > save the page... i''ll tell you later. > > > > tnx > > > > > On 27 Nov, 14:28, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I tested it on my localhost... you''ll need an apache server with PHP > > > > > running. > > > > > > wizz > > > > > > On 27 nov, 14:22, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Soon as possibile i''ll try it at home... tank you very much again, but > > > > > > you can confirm me that it''s not possibile test the page offline? > > > > > > > On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I''ve uploaded a slightly modified version to clarify what happens on > > > > > > > the serverside. > > > > > > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > > Wizz > > > > > > > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > If you would want to update a div with multiple variables, you would > > > > > > > > have to put it in a different var first if it is something more than > > > > > > > > just adding it. > > > > > > > > > //complex version > > > > > > > > var temp = ''<span class="type">''+json.type+''</span><span > > > > > > > > class="date">''+json.date+''</span>''; > > > > > > > > $(''div1'').update(temp); > > > > > > > > > // simple version > > > > > > > > $(''div1'').update(json.type + json.date); > > > > > > > > > the json.* variables are normal javascript vars, so they follow the > > > > > > > > same rules. > > > > > > > > > Remember: The variables you want to use have to be outputted by your > > > > > > > > serverside script first! > > > > > > > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > > > > > > > soon! > > > > > > > > > Thank you very much, but only a question: if i test offline, activex > > > > > > > > > block my page, > > > > > > > > > it''s true? There is a way? > > > > > > > > > > Then, if I want pass 2 variable, or more, in a div? > > > > > > > > > > $(''div1'').update(json.type&date); ??? > > > > > > > > > $(''div2'').update(json.date); > > > > > > > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > > > > > > > type=month|id=5 > > > > > > > > > and then split my string by | > > > > > > > > > > It''s possible? > > > > > > > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > I made a quick and very basic example for you to make it a bit > > > > > > > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > > > > > > > If you want to take a look at the code and structure, I zipped it all > > > > > > > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > > > > > > > to take a step back and learn a few things more before you try > > > > > > > > > > something like this again. > > > > > > > > > > > Greetz, > > > > > > > > > > > Wizz > > > > > > > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > I try with: > > > > > > > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > > > > > > > type=urbandesign'', { > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > $(''box'').update(json.type); > > > > > > > > > > > $(''box3'').update(json.type); > > > > > > > > > > > } > > > > > > > > > > > > }); " >xxx</a> > > > > > > > > > > > > but nothing... can you help me again? > > > > > > > > > > > Thx... > > > > > > > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > > > > > > > <head> > > > > > > > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > > > > > > > charset=iso-8859-1" /> > > > > > > > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > > > > > > > leftmargin="0" rightmargin="0"> > > > > > > > > > > > > <!-- header //--> > > > > > > > > > > > > <?php require(''includes/header.php''); ?> > > > > > > > > > > > > <!-- header_eof //--> > > > > > > > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > > > > > > > <tr> > > > > > > > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > > > > > > > div></td> > > > > > > > > > > > > > <div id="box"></div> > > > > > > > > > > > > <div id="box2"></div> > > > > > > > > > > > > > </td> > > > > > > > > > > > > </tr> > > > > > > > > > > > > > </table> > > > > > > > > > > > > </body> > > > > > > > > > > > > </html> > > > > > > > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > > > > > > > Please, i''ve not understood before... > > > > > > > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > <?php > > > > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > > > > ?> > > > > > > > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > > > > > > > div... > > > > > > > > > > > > > > And > > > > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > > > > } > > > > > > > > > > > > > > }); > > > > > > > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > > > > > > > And the link that call this one? > > > > > > > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > > > > > > > by other languages... like javascript. > > > > > > > > > > > > > > > <?php > > > > > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => ''Lorem ipsum'')); > > > > > > > > > > > > > > ?> > > > > > > > > > > > > > > // { ''id'': ''364'', ''read'': ''Lorem ipsum''} > > > > > > > > > > > > > > > This response is then easily parsed with the ''new'' reponseJSON in the > > > > > > > > > > > > > > Ajax class. > > > > > > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > }); > > ... > > leggi tutto- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You don''t have to use the json_encode() function, but it sure makes your job a lot easier. Wizz On 28 nov, 12:16, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I know PHP and POST or GET method, is a lot of years that I work with, > but I ask only if I must use the json_encode string to have result... > I must put the page online to testing... i''ll tell you later... thx > > On 27 Nov, 23:56, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You can have thousands of different results.. But I get the idea that > > you don''t fully grasp the concept of $_GET and $_POST variables in > > php... > > > Get and post variables are what the server receives as input... not as > > output. > > > for example: "content.php?type=hello&type2=world" > > // this would give you access to the following vars > > <?php > > $_GET[''type'']; // == hello > > $_GET[''type2'']; // == world > > ?> > > > the purpose of the json_encode is to output in a valid JSON format. > > Json is nothing else thena simpel string, but a lot of different > > scripting languages know how to interpret this string and turn it into > > an object. > > > <?php > > $var = ''hello''; > > $var2 = ''world''; > > $output = array( > > ''var'' => $var, > > ''var2'' => $var2 > > ); > > > echo json_encode($output); // = { ''var'' : ''hello'', ''var2'' : > > ''world'' } > > ?> > > > I really think you should start by reading up on your PHP skills and > > doing some tutorials, ''cause you seem to lack some familiarity with > > the logic behind it. > > > Wizz > > > As $var and $var2 are variables, you can assign any value to them that > > you want to return. > > On 27 nov, 18:56, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I can''t test in localhost :( > > > But while i''m working, in the page that you''ve named content.php > > > can I receive and manipulate data like this way? > > > > header(''Content-type: application/json''); > > > switch ($_GET[''type'']) { > > > case "0" : > > > echo "hallo div1"; > > > break; > > > case "1" : > > > echo "goodbye div1"; > > > break;} > > > > switch ($_GET[''type2'']) { > > > case "0" : > > > echo "hallo div1"; > > > break;} > > > > case "1" : > > > echo "goodbye div2"; > > > break; > > > ... > > > > So i''ll could have two different result in two different div. > > > Or I must use only echo json_encode($arr);? > > > > On 27 Nov, 16:01, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I don''t have a Mac I can test this on, but I just tested it in Safari > > > > for windows and it works like it''s supposed to... > > > > > remember that you have to access the ''index.html'' file and not the php- > > > > script that generates the data. > > > > > Wizz > > > > > On 27 nov, 15:53, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Mh.. strange because i work with mac, that have apache and php > > > > > inside... > > > > > i''ll try again... when i go on localhost, the browers ask me if i want > > > > > save the page... i''ll tell you later. > > > > > tnx > > > > > > On 27 Nov, 14:28, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I tested it on my localhost... you''ll need an apache server with PHP > > > > > > running. > > > > > > > wizz > > > > > > > On 27 nov, 14:22, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Soon as possibile i''ll try it at home... tank you very much again, but > > > > > > > you can confirm me that it''s not possibile test the page offline? > > > > > > > > On 27 Nov, 12:47, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I''ve uploaded a slightly modified version to clarify what happens on > > > > > > > > the serverside. > > > > > > > > >http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > > > Wizz > > > > > > > > > On 27 nov, 12:41, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > If you would want to update a div with multiple variables, you would > > > > > > > > > have to put it in a different var first if it is something more than > > > > > > > > > just adding it. > > > > > > > > > > //complex version > > > > > > > > > var temp = ''<span class="type">''+json.type+''</span><span > > > > > > > > > class="date">''+json.date+''</span>''; > > > > > > > > > $(''div1'').update(temp); > > > > > > > > > > // simple version > > > > > > > > > $(''div1'').update(json.type + json.date); > > > > > > > > > > the json.* variables are normal javascript vars, so they follow the > > > > > > > > > same rules. > > > > > > > > > > Remember: The variables you want to use have to be outputted by your > > > > > > > > > serverside script first! > > > > > > > > > > On 27 nov, 12:05, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > You''re so GREAT!! Now I have what i want... i''ll try it > > > > > > > > > > soon! > > > > > > > > > > Thank you very much, but only a question: if i test offline, activex > > > > > > > > > > block my page, > > > > > > > > > > it''s true? There is a way? > > > > > > > > > > > Then, if I want pass 2 variable, or more, in a div? > > > > > > > > > > > $(''div1'').update(json.type&date); ??? > > > > > > > > > > $(''div2'').update(json.date); > > > > > > > > > > > Otherelse i think to pass a variable like this: date=22-11-07| > > > > > > > > > > type=month|id=5 > > > > > > > > > > and then split my string by | > > > > > > > > > > > It''s possible? > > > > > > > > > > > On 27 Nov, 10:12, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > I made a quick and very basic example for you to make it a bit > > > > > > > > > > > clearer.http://newmillineon.nl/lab/semolino/ > > > > > > > > > > > > If you want to take a look at the code and structure, I zipped it all > > > > > > > > > > > up for you.http://newmillineon.nl/lab/semolino/load-two-divs.zip > > > > > > > > > > > > Hope you grab the concept a little bit now... otherwise you might want > > > > > > > > > > > to take a step back and learn a few things more before you try > > > > > > > > > > > something like this again. > > > > > > > > > > > > Greetz, > > > > > > > > > > > > Wizz > > > > > > > > > > > > On 27 nov, 01:44, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > I try with: > > > > > > > > > > > > <a href="#" onclick="new Ajax.Request(''boxes/project_.php? > > > > > > > > > > > > type=urbandesign'', { > > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > > $(''box'').update(json.type); > > > > > > > > > > > > $(''box3'').update(json.type); > > > > > > > > > > > > } > > > > > > > > > > > > > }); " >xxx</a> > > > > > > > > > > > > > but nothing... can you help me again? > > > > > > > > > > > > Thx... > > > > > > > > > > > > > On 26 Nov, 20:57, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> > > > > > > > > > > > > > <head> > > > > > > > > > > > > > <meta http-equiv="Content-Type" content="text/html; > > > > > > > > > > > > > charset=iso-8859-1" /> > > > > > > > > > > > > > > <script src="js/prototype.js" type="text/javascript"></script> > > > > > > > > > > > > > <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" > > > > > > > > > > > > > leftmargin="0" rightmargin="0"> > > > > > > > > > > > > > <!-- header //--> > > > > > > > > > > > > > <?php require(''includes/header.php''); ?> > > > > > > > > > > > > > <!-- header_eof //--> > > > > > > > > > > > > > > <table id="Table_01" width="764" height="650" border="0" > > > > > > > > > > > > > cellpadding="0" cellspacing="0" align="center"> > > > > > > > > > > > > > <tr> > > > > > > > > > > > > > <td width="764" height="100%" align="center" valign="top"> > > > > > > > > > > > > > <div id="content"><a href="boxes/project.php?type=housing">link</a</ > > > > > > > > > > > > > div></td> > > > > > > > > > > > > > > <div id="box"></div> > > > > > > > > > > > > > <div id="box2"></div> > > > > > > > > > > > > > > </td> > > > > > > > > > > > > > </tr> > > > > > > > > > > > > > > </table> > > > > > > > > > > > > > </body> > > > > > > > > > > > > > </html> > > > > > > > > > > > > > > Well, this is my page, how can load my page linked in box and box2? > > > > > > > > > > > > > Please, i''ve not understood before... > > > > > > > > > > > > > On 26 Nov, 17:59, semolino <simone.zane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > <?php > > > > > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > > > > > ?> > > > > > > > > > > > > > > I put this in the index.php page? This is the page where a load all > > > > > > > > > > > > > > div... > > > > > > > > > > > > > > > And > > > > > > > > > > > > > > new Ajax.Request(''url.php'', { > > > > > > > > > > > > > > > onComplete: function(transport) { > > > > > > > > > > > > > > var json = transport.responseJSON; > > > > > > > > > > > > > > $(''div1'').update(json.id); > > > > > > > > > > > > > > $(''div2'').update(json.read); > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > }); > > > > > > > > > > > > > > > Also this code I put in the same page between tag <script></script>? > > > > > > > > > > > > > > And the link that call this one? > > > > > > > > > > > > > > Sorry but it''s first time, and I''ve a lot of confusion... > > > > > > > > > > > > > > > On 26 Nov, 16:55, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > > Updating two different target from one result is not as one target, > > > > > > > > > > > > > > > but it is possible. A way to accomplish this is to send back the > > > > > > > > > > > > > > > result in a JSON format and parse it on the client side. > > > > > > > > > > > > > > > > If you are using PHP on the backend, json_encode is your friend. > > > > > > > > > > > > > > > (http://nl3.php.net/manual/nl/ref.json.php) > > > > > > > > > > > > > > > It can transform arrays and what not into a JSON format for easy use > > > > > > > > > > > > > > > by other languages... like javascript. > > > > > > > > > > > > > > > > <?php > > > > > > > > > > > > > > > header(''Content-type: application/json''); > > > > > > > > > > > > > > > echo json_encode(array(''id'' => 364, ''read'' => > > ... > > meer lezen >>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---