jQuery: The Write Less, Do More JavaScript Library

Load a content from remote div

View: New views
5 Messages — Rating Filter:   Alert me  

Load a content from remote div

by Ricardo-63 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys!

I need to load a remote content from a specific remote div.

Scene:
I have a page called products.php, into i have a div with id="infos"
and now o i need to take that <div id="info"> and load in another page
called random.php.

Who can i do that?


Thanks.

Re: Load a content from remote div

by Jonathan Vanherpe (T & T NV) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ricardo wrote:

> Hi guys!
>
> I need to load a remote content from a specific remote div.
>
> Scene:
> I have a page called products.php, into i have a div with id="infos"
> and now o i need to take that<div id="info">  and load in another page
> called random.php.
>
> Who can i do that?
>
>
> Thanks.
>
$('#your_recieving_element').load('http://your.url.com/you-content-document.html 
#the_part_you_want_to_insert_in_your_receiving_element > *')

see: http://docs.jquery.com/Ajax/load

Copied from Michel's post in the thread just above yours ;-) .

You might want to consider changing you php page so it only sends the
data you want, because this method will load the whole page in the
background, analyse it, and copy the contents of the id, which is a bit
wasteful.

Jonathan

--
Jonathan Vanherpe - Tallieu & Tallieu NV - jonathan@...

Re: Load a content from remote div

by Ricardo-63 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Jonathan, but it's not that.

I will explain again, more detailed.



http://www.domain1.com/produtcts.php
...
<div id="info"></div>
...


http://www.domain2.com/random.php
...
<div id="receive_info">/div>
....


I need to take a div from a remote domain.




On 6 nov, 11:11, "Jonathan Vanherpe (T & T NV)" <jonat...@...>
wrote:

> Ricardo wrote:
> > Hi guys!
>
> > I need to load a remote content from a specific remote div.
>
> > Scene:
> > I have a page called products.php, into i have a div with id="infos"
> > and now o i need to take that<div id="info">  and load in another page
> > called random.php.
>
> > Who can i do that?
>
> > Thanks.
>
> $('#your_recieving_element').load('http://your.url.com/you-content-document.html
> #the_part_you_want_to_insert_in_your_receiving_element > *')
>
> see:http://docs.jquery.com/Ajax/load
>
> Copied from Michel's post in the thread just above yours ;-) .
>
> You might want to consider changing you php page so it only sends the
> data you want, because this method will load the whole page in the
> background, analyse it, and copy the contents of the id, which is a bit
> wasteful.
>
> Jonathan
>
> --
> Jonathan Vanherpe - Tallieu & Tallieu NV - jonat...@...

Re: Re: Load a content from remote div

by Jonathan Vanherpe (T & T NV) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That won't work. Javascript won't allow you to load data from a
different domain.

You can get around that by writing a simple php proxy that runs on your
server, though.

Jonathan

Ricardo wrote:

> Thanks Jonathan, but it's not that.
>
> I will explain again, more detailed.
>
>
>
> http://www.domain1.com/produtcts.php
> ...
> <div id="info"></div>
> ...
>
>
> http://www.domain2.com/random.php
> ...
> <div id="receive_info">/div>
> ....
>
>
> I need to take a div from a remote domain.
>
>
>
>
> On 6 nov, 11:11, "Jonathan Vanherpe (T&  T NV)"<jonat...@...>
> wrote:
>> Ricardo wrote:
>>> Hi guys!
>>
>>> I need to load a remote content from a specific remote div.
>>
>>> Scene:
>>> I have a page called products.php, into i have a div with id="infos"
>>> and now o i need to take that<div id="info">    and load in another page
>>> called random.php.
>>
>>> Who can i do that?
>>
>>> Thanks.
>>
>> $('#your_recieving_element').load('http://your.url.com/you-content-document.html
>> #the_part_you_want_to_insert_in_your_receiving_element>  *')
>>
>> see:http://docs.jquery.com/Ajax/load
>>
>> Copied from Michel's post in the thread just above yours ;-) .
>>
>> You might want to consider changing you php page so it only sends the
>> data you want, because this method will load the whole page in the
>> background, analyse it, and copy the contents of the id, which is a bit
>> wasteful.
>>
>> Jonathan
>>
>> --
>> Jonathan Vanherpe - Tallieu&  Tallieu NV - jonat...@...
>


--
Jonathan Vanherpe - Tallieu & Tallieu NV - jonathan@...

Re: Load a content from remote div

by Ricardo-63 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok. I will find out some examples.

Thanks


On 6 nov, 11:35, "Jonathan Vanherpe (T & T NV)" <jonat...@...>
wrote:

> That won't work. Javascript won't allow you to load data from a
> different domain.
>
> You can get around that by writing a simple php proxy that runs on your
> server, though.
>
> Jonathan
>
>
>
>
>
> Ricardo wrote:
> > Thanks Jonathan, but it's not that.
>
> > I will explain again, more detailed.
>
> >http://www.domain1.com/produtcts.php
> > ...
> > <div id="info"></div>
> > ...
>
> >http://www.domain2.com/random.php
> > ...
> > <div id="receive_info">/div>
> > ....
>
> > I need to take a div from a remote domain.
>
> > On 6 nov, 11:11, "Jonathan Vanherpe (T&  T NV)"<jonat...@...>
> > wrote:
> >> Ricardo wrote:
> >>> Hi guys!
>
> >>> I need to load a remote content from a specific remote div.
>
> >>> Scene:
> >>> I have a page called products.php, into i have a div with id="infos"
> >>> and now o i need to take that<div id="info">    and load in another page
> >>> called random.php.
>
> >>> Who can i do that?
>
> >>> Thanks.
>
> >> $('#your_recieving_element').load('http://your.url.com/you-content-document.html
> >> #the_part_you_want_to_insert_in_your_receiving_element>  *')
>
> >> see:http://docs.jquery.com/Ajax/load
>
> >> Copied from Michel's post in the thread just above yours ;-) .
>
> >> You might want to consider changing you php page so it only sends the
> >> data you want, because this method will load the whole page in the
> >> background, analyse it, and copy the contents of the id, which is a bit
> >> wasteful.
>
> >> Jonathan
>
> >> --
> >> Jonathan Vanherpe - Tallieu&  Tallieu NV - jonat...@...
>
> --
> Jonathan Vanherpe - Tallieu & Tallieu NV - jonat...@...