[jQuery] Can't load a page from a loaded page.

2009-10-01 Thread smwithdm

I'm trying to load a page using the .load(url) from an already loaded
page, but nothing responds. Below is a simple sample page created to
show what I want to accomplish.
Also, I'm using JQuery 1.3.

- index.html -




$(document).ready(function() {
$("#mainview").load("page01.html");
$("#clickme").click(function(){
$("#mainview").load("page02.html");
});
$("#clickme2").click(function(){
$("#mainview").load("page03.html");
});
$("#clickme3").click(function(){
$("#mainview").load("page04.html");
});
});







- END of index.html -

- page01.html -


This is page01.html
Click Me!
some stuffs



- END of page01.html -

- page02.html -


This is page02.html
Click Me!
some more stuffs again



- END of page02.html -

- page03.html -


This is page03.html
Click Me!
some more stuffs again



- END of page03.html -

When the index.html page loads up, the page01.html loads into
#mainview.
And when I try to click on the Click Me!
inside page01.html to load page02.html, nothing works.

Just can't figure out what's wrong... If someone knows an easy trick,
please help me out. Thank You!


[jQuery] Re: Can't load a page from a loaded page.

2009-10-01 Thread smwithdm

Chrazy,

Thank you for your great info!

I changed it as you said but didn't work.
I so looked at the api reference and did some homework and changed it
to the following and worked all fine!
I just had to change all load() to live()s.

Once again, thank you and thank you to JQuery!

- index.html - only changed places.


$(document).ready(function(){
$("#mainview").load("page01.html");
$("#clickme").live("click", function(){
$("#mainview").load("page02.html");
});
$("#clickme2").live("click", function(){
$("#mainview").load("page03.html");
});
$("#clickme3").live("click", function(){
$("#mainview").load("page04.html");
});
});


- END of index.html changed places. -

On 10月1日, 午前8:02, Chrazy  wrote:
> You have to use the live() event.
>
> So instead of:
>   $("#clickme2").click(function(){
>                  $("#mainview").load("page03.html");
>          });
>
> You write:
>
>  $("#clickme2").live('click', function(){
>                  $("#mainview").load("page03.html");
>          });
>
> Functions will just work with objects already in the DOM unless you
> bind them with live.
>
> On 1 Okt, 07:45, smwithdm  wrote:
>
>
>
> > I'm trying toloadapageusing the .load(url) from an alreadyloaded
> >page, but nothing responds. Below is a simple samplepagecreated to
> > show what I want to accomplish.
> > Also, I'm using JQuery 1.3.
>
> > - index.html -
> > 
> > 
> > 
> > 
> > $(document).ready(function() {
> >         $("#mainview").load("page01.html");
> >         $("#clickme").click(function(){
> >                 $("#mainview").load("page02.html");
> >         });
> >         $("#clickme2").click(function(){
> >                 $("#mainview").load("page03.html");
> >         });
> >         $("#clickme3").click(function(){
> >                 $("#mainview").load("page04.html");
> >         });});
>
> > 
> > 
> > 
> > 
> > 
> > 
>
> > - END of index.html -
>
> > - page01.html -
>
> > 
> > This is page01.html
> > Click Me!
> > some stuffs
> > 
> > 
>
> > - END of page01.html -
>
> > - page02.html -
>
> > 
> > This is page02.html
> > Click Me!
> > some more stuffs again
> > 
> > 
>
> > - END of page02.html -
>
> > - page03.html -
>
> > 
> > This is page03.html
> > Click Me!
> > some more stuffs again
> > 
> > 
>
> > - END of page03.html -
>
> > When the index.htmlpageloads up, the page01.html loads into
> > #mainview.
> > And when I try to click on the Click Me!
> > inside page01.html toloadpage02.html, nothing works.
>
> > Just can't figure out what's wrong... If someone knows an easy trick,
> > please help me out. Thank You!


[jQuery] Re: Can't load a page from a loaded page.

2009-10-01 Thread smwithdm

Sorry, I meant click()s to live().


On 10月1日, 午前10:49, smwithdm  wrote:
> Chrazy,
>
> Thank you for your great info!
>
> I changed it as you said but didn't work.
> I so looked at the api reference and did some homework and changed it
> to the following and worked all fine!
> I just had to change allload() to live()s.
>
> Once again, thank you and thank you to JQuery!
>
> - index.html - only changed places.
>
> 
> $(document).ready(function(){
>         $("#mainview").load("page01.html");
>         $("#clickme").live("click", function(){
>                 $("#mainview").load("page02.html");
>         });
>         $("#clickme2").live("click", function(){
>                 $("#mainview").load("page03.html");
>         });
>         $("#clickme3").live("click", function(){
>                 $("#mainview").load("page04.html");
>         });});
>
> 
>
> - END of index.html changed places. -
>
> On 10月1日, 午前8:02, Chrazy  wrote:
>
>
>
> > You have to use the live() event.
>
> > So instead of:
> >   $("#clickme2").click(function(){
> >                  $("#mainview").load("page03.html");
> >          });
>
> > You write:
>
> >  $("#clickme2").live('click', function(){
> >                  $("#mainview").load("page03.html");
> >          });
>
> > Functions will just work with objects already in the DOM unless you
> > bind them with live.
>
> > On 1 Okt, 07:45, smwithdm  wrote:
>
> > > I'm trying toloadapageusing the .load(url) from an alreadyloaded
> > >page, but nothing responds. Below is a simple samplepagecreated to
> > > show what I want to accomplish.
> > > Also, I'm using JQuery 1.3.
>
> > > - index.html -
> > > 
> > > 
> > > 
> > > 
> > > $(document).ready(function() {
> > >         $("#mainview").load("page01.html");
> > >         $("#clickme").click(function(){
> > >                 $("#mainview").load("page02.html");
> > >         });
> > >         $("#clickme2").click(function(){
> > >                 $("#mainview").load("page03.html");
> > >         });
> > >         $("#clickme3").click(function(){
> > >                 $("#mainview").load("page04.html");
> > >         });});
>
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
>
> > > - END of index.html -
>
> > > - page01.html -
>
> > > 
> > > This is page01.html
> > > Click Me!
> > > some stuffs
> > > 
> > > 
>
> > > - END of page01.html -
>
> > > - page02.html -
>
> > > 
> > > This is page02.html
> > > Click Me!
> > > some more stuffs again
> > > 
> > > 
>
> > > - END of page02.html -
>
> > > - page03.html -
>
> > > 
> > > This is page03.html
> > > Click Me!
> > > some more stuffs again
> > > 
> > > 
>
> > > - END of page03.html -
>
> > > When the index.htmlpageloads up, the page01.html loads into
> > > #mainview.
> > > And when I try to click on the Click Me!
> > > inside page01.html toloadpage02.html, nothing works.
>
> > > Just can't figure out what's wrong... If someone knows an easy trick,
> > > please help me out. Thank You!