
|
Need help on How to load content via AJAX in jQuery
|

|
Re: Need help on How to load content via AJAX in jQuery
Hello.
I see you succed retrieving data using ajax,
Which is the problem?
----- Original Message -----
From: "Erik R. Peterson" < eriksnet@...>
To: < jquery-en@...>
Sent: Friday, July 03, 2009 2:48 PM
Subject: [jQuery] Need help on How to load content via AJAX in jQuery
|

|
Re: Need help on How to load content via AJAX in jQuery
Hi buddy!
I'm undecided on the final buttons and graphics, but thanks to your
help I got the script down.
I actually fixed my own problem after posted this last email.
Have a great weekend.
Erik
On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
|

|
Re: Need help on How to load content via AJAX in jQuery
Hi,
on your page: http://www.enaturalskin.com/needhelp.htmeach time the window scroll to the top because of anchor #, use
preventDefault(); to avoid this, just a suggestion.
Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/This trick will make your website work though there is no javascript.
-Beschi.
On Jul 4, 4:14 am, "Erik R. Peterson" < eriks...@...> wrote:
> Hi buddy!
>
> I'm undecided on the final buttons and graphics, but thanks to your
> help I got the script down.
>
> I actually fixed my own problem after posted this last email.
>
> Have a great weekend.
>
> Erik
>
> On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
>
>
>
> > Hello.
>
> > I see you succed retrieving data using ajax,
>
> > Which is the problem?
>
> > ----- Original Message ----- From: "Erik R. Peterson" < eriks...@...
>
> > To: < jquery-en@...>
> > Sent: Friday, July 03, 2009 2:48 PM
> > Subject: [jQuery] Need help on How to load content via AJAX in jQuery
>
> >> I found this script:
> >> http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/> >> I got it working, but it really looks bad in IE, along with erros.
> >> Any alternatives or sugestions?
> >> Here is my page: http://www.enaturalskin.com/needhelp.htm> >> Many thanks.
> >> Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
Works great...
Would you be able to show me how to make the links change via css
after selected?
Erik
On Jul 4, 2009, at 6:40 AM, MOZ wrote:
>
> Hi,
> on your page: http://www.enaturalskin.com/needhelp.htm> each time the window scroll to the top because of anchor #, use
> preventDefault(); to avoid this, just a suggestion.
>
> Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/> This trick will make your website work though there is no javascript.
>
> -Beschi.
>
> On Jul 4, 4:14 am, "Erik R. Peterson" < eriks...@...> wrote:
>> Hi buddy!
>>
>> I'm undecided on the final buttons and graphics, but thanks to your
>> help I got the script down.
>>
>> I actually fixed my own problem after posted this last email.
>>
>> Have a great weekend.
>>
>> Erik
>>
>> On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
>>
>>
>>
>>> Hello.
>>
>>> I see you succed retrieving data using ajax,
>>
>>> Which is the problem?
>>
>>> ----- Original Message ----- From: "Erik R. Peterson"
>>> < eriks...@...
>>
>>> To: < jquery-en@...>
>>> Sent: Friday, July 03, 2009 2:48 PM
>>> Subject: [jQuery] Need help on How to load content via AJAX in
>>> jQuery
>>
>>>> I found this script:
>>>> http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/>>>> I got it working, but it really looks bad in IE, along with erros.
>>>> Any alternatives or sugestions?
>>>> Here is my page: http://www.enaturalskin.com/needhelp.htm>>>> Many thanks.
>>>> Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
Can;t get it to work correctly.
Here is my existing code:
$(document).ready(function(){
//References
var sections = $("#cs_links a");
var loading = $("#loading");
var content = $("#cst_wrap_mid");
//Manage click events
sections.click(function(){
//show the loading bar
showLoading();
//load selected section
switch(this.id){
case "js_appoint":
content.slideUp();
content.load("/externals/appoint.htm", hideLoading);
content.slideDown();
break;
case "js_contact":
content.slideUp();
content.load("/externals/contact.htm", hideLoading);
content.slideDown();
break;
case "js_gifts":
content.slideUp();
content.load("/externals/gifts.htm", hideLoading);
content.slideDown();
break;
case "js_order":
content.slideUp();
content.load("/externals/order.htm", hideLoading);
content.slideDown();
break;
case "js_promise":
content.slideUp();
content.load("/externals/promise.htm", hideLoading);
content.slideDown();
break;
case "js_quest":
content.slideUp();
content.load("/externals/quest.htm", hideLoading);
content.slideDown();
break;
case "js_returns":
content.slideUp();
content.load("/externals/returns.htm", hideLoading);
content.slideDown();
break;
case "js_secure":
content.slideUp();
content.load("/externals/secure.htm", hideLoading);
content.slideDown();
break;
case "js_shipping":
content.slideUp();
content.load("/externals/shipping.htm", hideLoading);
content.slideDown();
break;
case "js_terms":
content.slideUp();
content.load("/externals/terms.htm", hideLoading);
content.slideDown();
break;
case "js_types":
content.slideUp();
content.load("/externals/types.htm", hideLoading);
content.slideDown();
break;
default:
//hide loading bar if there is no selected section
hideLoading();
break;
}
});
//show loading bar
function showLoading(){
loading
.css({visibility:"visible"})
.css({opacity:"1"})
.css({display:"block"})
;
}
//hide loading bar
function hideLoading(){
loading.fadeTo(1000, 0);
};
});
On Jul 4, 2009, at 6:40 AM, MOZ wrote:
>
> Hi,
> on your page: http://www.enaturalskin.com/needhelp.htm> each time the window scroll to the top because of anchor #, use
> preventDefault(); to avoid this, just a suggestion.
>
> Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/> This trick will make your website work though there is no javascript.
>
> -Beschi.
>
> On Jul 4, 4:14 am, "Erik R. Peterson" < eriks...@...> wrote:
>> Hi buddy!
>>
>> I'm undecided on the final buttons and graphics, but thanks to your
>> help I got the script down.
>>
>> I actually fixed my own problem after posted this last email.
>>
>> Have a great weekend.
>>
>> Erik
>>
>> On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
>>
>>
>>
>>> Hello.
>>
>>> I see you succed retrieving data using ajax,
>>
>>> Which is the problem?
>>
>>> ----- Original Message ----- From: "Erik R. Peterson"
>>> < eriks...@...
>>
>>> To: < jquery-en@...>
>>> Sent: Friday, July 03, 2009 2:48 PM
>>> Subject: [jQuery] Need help on How to load content via AJAX in
>>> jQuery
>>
>>>> I found this script:
>>>> http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/>>>> I got it working, but it really looks bad in IE, along with erros.
>>>> Any alternatives or sugestions?
>>>> Here is my page: http://www.enaturalskin.com/needhelp.htm>>>> Many thanks.
>>>> Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
could shorten this all up and make it accessible for javascript
disabled by putting the url into the href of your links.
Haven't looked at plugin but since you're just loading html will use
load() in jQuery core:
hideLoading();
$("#cs_links a").click(function () {
showLoading();
$("#cst_wrap_mid").slideUp();
$("#cst_wrap_mid").load($(this).attr("href"), function(){
$("#cst_wrap_mid").slideUp();
hideLoading();
});
return false;
});
This would replace all of the switch cases. If javascript disabled
appropriate page would open from href. Likely find that load is very
fast and showloading may not be necessary
Erik R. Peterson wrote:
Can;t get it to work correctly.
Here is my existing code:
$(document).ready(function(){
//References
var sections = $("#cs_links a");
var loading = $("#loading");
var content = $("#cst_wrap_mid");
//Manage click events
sections.click(function(){
//show the loading bar
showLoading();
//load selected section
switch(this.id){
case "js_appoint":
content.slideUp();
content.load("/externals/appoint.htm", hideLoading);
content.slideDown();
break;
case "js_contact":
content.slideUp();
content.load("/externals/contact.htm", hideLoading);
content.slideDown();
break;
case "js_gifts":
content.slideUp();
content.load("/externals/gifts.htm", hideLoading);
content.slideDown();
break;
case "js_order":
content.slideUp();
content.load("/externals/order.htm", hideLoading);
content.slideDown();
break;
case "js_promise":
content.slideUp();
content.load("/externals/promise.htm", hideLoading);
content.slideDown();
break;
case "js_quest":
content.slideUp();
content.load("/externals/quest.htm", hideLoading);
content.slideDown();
break;
case "js_returns":
content.slideUp();
content.load("/externals/returns.htm", hideLoading);
content.slideDown();
break;
case "js_secure":
content.slideUp();
content.load("/externals/secure.htm", hideLoading);
content.slideDown();
break;
case "js_shipping":
content.slideUp();
content.load("/externals/shipping.htm", hideLoading);
content.slideDown();
break;
case "js_terms":
content.slideUp();
content.load("/externals/terms.htm", hideLoading);
content.slideDown();
break;
case "js_types":
content.slideUp();
content.load("/externals/types.htm", hideLoading);
content.slideDown();
break;
default:
//hide loading bar if there is no selected section
hideLoading();
break;
}
});
//show loading bar
function showLoading(){
loading
.css({visibility:"visible"})
.css({opacity:"1"})
.css({display:"block"})
;
}
//hide loading bar
function hideLoading(){
loading.fadeTo(1000, 0);
};
});
On Jul 4, 2009, at 6:40 AM, MOZ wrote:
Hi,
on your page: http://www.enaturalskin.com/needhelp.htm
each time the window scroll to the top because of anchor #, use
preventDefault(); to avoid this, just a suggestion.
Also see the improved version:
http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/
This trick will make your website work though there is no javascript.
-Beschi.
On Jul 4, 4:14 am, "Erik R. Peterson" eriks...@... wrote:
Hi buddy!
I'm undecided on the final buttons and graphics, but thanks to your
help I got the script down.
I actually fixed my own problem after posted this last email.
Have a great weekend.
Erik
On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
Hello.
I see you
succed retrieving data using ajax,
Which is
the problem?
-----
Original Message ----- From: "Erik R. Peterson" <eriks...@...
To:
jquery-en@...
Sent: Friday, July 03, 2009 2:48 PM
Subject: [jQuery] Need help on How to load content via AJAX in jQuery
I found
this script:
http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/
I got it working, but it really looks bad in IE, along with erros.
Any alternatives or sugestions?
Here is my page: http://www.enaturalskin.com/needhelp.htm
Many thanks.
Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
Thanks Charlie,
I'll put it in now. thanks.
E
On Jul 4, 2009, at 9:56 AM, Charlie wrote: could shorten this all up and make it accessible for javascript disabled by putting the url into the href of your links. Haven't looked at plugin but since you're just loading html will use load() in jQuery core: hideLoading(); $("#cs_links a").click(function () { showLoading(); $("#cst_wrap_mid").slideUp(); $("#cst_wrap_mid").load($(this).attr("href"), function(){ $("#cst_wrap_mid").slideUp(); hideLoading(); }); return false; }); This would replace all of the switch cases. If javascript disabled appropriate page would open from href. Likely find that load is very fast and showloading may not be necessary Erik R. Peterson wrote: Can;t get it to work correctly. Here is my existing code: $(document).ready(function(){ //References var sections = $("#cs_links a"); var loading = $("#loading"); var content = $("#cst_wrap_mid"); //Manage click events sections.click(function(){ //show the loading bar showLoading(); //load selected section switch(this.id){ case "js_appoint": content.slideUp(); content.load("/externals/appoint.htm", hideLoading); content.slideDown(); break; case "js_contact": content.slideUp(); content.load("/externals/contact.htm", hideLoading); content.slideDown(); break; case "js_gifts": content.slideUp(); content.load("/externals/gifts.htm", hideLoading); content.slideDown(); break; case "js_order": content.slideUp(); content.load("/externals/order.htm", hideLoading); content.slideDown(); break; case "js_promise": content.slideUp(); content.load("/externals/promise.htm", hideLoading); content.slideDown(); break; case "js_quest": content.slideUp(); content.load("/externals/quest.htm", hideLoading); content.slideDown(); break; case "js_returns": content.slideUp(); content.load("/externals/returns.htm", hideLoading); content.slideDown(); break; case "js_secure": content.slideUp(); content.load("/externals/secure.htm", hideLoading); content.slideDown(); break; case "js_shipping": content.slideUp(); content.load("/externals/shipping.htm", hideLoading); content.slideDown(); break; case "js_terms": content.slideUp(); content.load("/externals/terms.htm", hideLoading); content.slideDown(); break; case "js_types": content.slideUp(); content.load("/externals/types.htm", hideLoading); content.slideDown(); break; default: //hide loading bar if there is no selected section hideLoading(); break; } }); //show loading bar function showLoading(){ loading .css({visibility:"visible"}) .css({opacity:"1"}) .css({display:"block"}) ; } //hide loading bar function hideLoading(){ loading.fadeTo(1000, 0); }; }); On Jul 4, 2009, at 6:40 AM, MOZ wrote: Hi, on your page: http://www.enaturalskin.com/needhelp.htm each time the window scroll to the top because of anchor #, use preventDefault(); to avoid this, just a suggestion. Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/ This trick will make your website work though there is no javascript. -Beschi. On Jul 4, 4:14 am, "Erik R. Peterson" eriks...@... wrote: Hi buddy! I'm undecided on the final buttons and graphics, but thanks to your help I got the script down. I actually fixed my own problem after posted this last email. Have a great weekend. Erik On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote: Hello. I see you succed retrieving data using ajax, Which is the problem? ----- Original Message ----- From: "Erik R. Peterson" <eriks...@... To: jquery-en@... Sent: Friday, July 03, 2009 2:48 PM Subject: [jQuery] Need help on How to load content via AJAX in jQuery I found this script: http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/ I got it working, but it really looks bad in IE, along with erros. Any alternatives or sugestions? Here is my page: http://www.enaturalskin.com/needhelp.htm Many thanks. Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
I gave you slideUp twice...oops...bad copy paste
Erik R. Peterson wrote:
Thanks
Charlie,
I'll put it in now. thanks.
E
On Jul 4, 2009, at 9:56 AM, Charlie wrote:
could shorten this all up
and make it accessible for javascript disabled by putting the url into
the href of your links.
Haven't looked at plugin but since you're just loading html will use
load() in jQuery core:
hideLoading();
$("#cs_links a").click(function () {
showLoading();
$("#cst_wrap_mid").slideUp();
$("#cst_wrap_mid").load($(this).attr("href"), function(){
$("#cst_wrap_mid").slideUp();
hideLoading();
});
return false;
});
This would replace all of the switch cases. If javascript disabled
appropriate page would open from href. Likely find that load is very
fast and showloading may not be necessary
Erik R. Peterson wrote:
Can;t get it to work correctly.
Here is my existing code:
$(document).ready(function(){
//References
var sections = $("#cs_links a");
var loading = $("#loading");
var content = $("#cst_wrap_mid");
//Manage click events
sections.click(function(){
//show the loading bar
showLoading();
//load selected section
switch(this.id){
case "js_appoint":
content.slideUp();
content.load("/externals/appoint.htm", hideLoading);
content.slideDown();
break;
case "js_contact":
content.slideUp();
content.load("/externals/contact.htm", hideLoading);
content.slideDown();
break;
case "js_gifts":
content.slideUp();
content.load("/externals/gifts.htm", hideLoading);
content.slideDown();
break;
case "js_order":
content.slideUp();
content.load("/externals/order.htm", hideLoading);
content.slideDown();
break;
case "js_promise":
content.slideUp();
content.load("/externals/promise.htm", hideLoading);
content.slideDown();
break;
case "js_quest":
content.slideUp();
content.load("/externals/quest.htm", hideLoading);
content.slideDown();
break;
case "js_returns":
content.slideUp();
content.load("/externals/returns.htm", hideLoading);
content.slideDown();
break;
case "js_secure":
content.slideUp();
content.load("/externals/secure.htm", hideLoading);
content.slideDown();
break;
case "js_shipping":
content.slideUp();
content.load("/externals/shipping.htm", hideLoading);
content.slideDown();
break;
case "js_terms":
content.slideUp();
content.load("/externals/terms.htm", hideLoading);
content.slideDown();
break;
case "js_types":
content.slideUp();
content.load("/externals/types.htm", hideLoading);
content.slideDown();
break;
default:
//hide loading bar if there is no selected section
hideLoading();
break;
}
});
//show loading bar
function showLoading(){
loading
.css({visibility:"visible"})
.css({opacity:"1"})
.css({display:"block"})
;
}
//hide loading bar
function hideLoading(){
loading.fadeTo(1000, 0);
};
});
On Jul 4, 2009, at 6:40 AM, MOZ wrote:
Hi,
on your page: http://www.enaturalskin.com/needhelp.htm
each time the window scroll to the top because of anchor #, use
preventDefault(); to avoid this, just a suggestion.
Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/
This trick will make your website work though there is no javascript.
-Beschi.
On Jul 4, 4:14 am, "Erik R. Peterson" eriks...@...
wrote:
Hi
buddy!
I'm undecided on the final buttons and graphics, but thanks to your
help I got the script down.
I actually fixed my own problem after posted this last email.
Have a great weekend.
Erik
On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote:
Hello.
I see
you succed retrieving data using ajax,
Which
is the problem?
-----
Original Message ----- From: "Erik R. Peterson" <eriks...@...
To: jquery-en@...
Sent: Friday, July 03, 2009 2:48 PM
Subject: [jQuery] Need help on How to load content via AJAX in jQuery
I
found this script:
http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/
I got it working, but it really looks bad in IE, along with erros.
Any alternatives or sugestions?
Here is my page: http://www.enaturalskin.com/needhelp.htm
Many thanks.
Erik
|

|
Re: Need help on How to load content via AJAX in jQuery
Where am I placing the link for each tag? Are the link identified in the JS or the html?
E
On Jul 4, 2009, at 10:18 AM, Charlie wrote: I gave you slideUp twice...oops...bad copy paste Erik R. Peterson wrote: Thanks Charlie, I'll put it in now. thanks. E On Jul 4, 2009, at 9:56 AM, Charlie wrote: could shorten this all up and make it accessible for javascript disabled by putting the url into the href of your links. Haven't looked at plugin but since you're just loading html will use load() in jQuery core: hideLoading(); $("#cs_links a").click(function () { showLoading(); $("#cst_wrap_mid").slideUp(); $("#cst_wrap_mid").load($(this).attr("href"), function(){ $("#cst_wrap_mid").slideUp(); hideLoading(); }); return false; }); This would replace all of the switch cases. If javascript disabled appropriate page would open from href. Likely find that load is very fast and showloading may not be necessary Erik R. Peterson wrote: Can;t get it to work correctly. Here is my existing code: $(document).ready(function(){ //References var sections = $("#cs_links a"); var loading = $("#loading"); var content = $("#cst_wrap_mid"); //Manage click events sections.click(function(){ //show the loading bar showLoading(); //load selected section switch(this.id){ case "js_appoint": content.slideUp(); content.load("/externals/appoint.htm", hideLoading); content.slideDown(); break; case "js_contact": content.slideUp(); content.load("/externals/contact.htm", hideLoading); content.slideDown(); break; case "js_gifts": content.slideUp(); content.load("/externals/gifts.htm", hideLoading); content.slideDown(); break; case "js_order": content.slideUp(); content.load("/externals/order.htm", hideLoading); content.slideDown(); break; case "js_promise": content.slideUp(); content.load("/externals/promise.htm", hideLoading); content.slideDown(); break; case "js_quest": content.slideUp(); content.load("/externals/quest.htm", hideLoading); content.slideDown(); break; case "js_returns": content.slideUp(); content.load("/externals/returns.htm", hideLoading); content.slideDown(); break; case "js_secure": content.slideUp(); content.load("/externals/secure.htm", hideLoading); content.slideDown(); break; case "js_shipping": content.slideUp(); content.load("/externals/shipping.htm", hideLoading); content.slideDown(); break; case "js_terms": content.slideUp(); content.load("/externals/terms.htm", hideLoading); content.slideDown(); break; case "js_types": content.slideUp(); content.load("/externals/types.htm", hideLoading); content.slideDown(); break; default: //hide loading bar if there is no selected section hideLoading(); break; } }); //show loading bar function showLoading(){ loading .css({visibility:"visible"}) .css({opacity:"1"}) .css({display:"block"}) ; } //hide loading bar function hideLoading(){ loading.fadeTo(1000, 0); }; }); On Jul 4, 2009, at 6:40 AM, MOZ wrote: Hi, on your page: http://www.enaturalskin.com/needhelp.htm each time the window scroll to the top because of anchor #, use preventDefault(); to avoid this, just a suggestion. Also see the improved version: http://yensdesign.com/2009/06/safe-ajax-links-using-jquery/ This trick will make your website work though there is no javascript. -Beschi. On Jul 4, 4:14 am, "Erik R. Peterson" eriks...@... wrote: Hi buddy! I'm undecided on the final buttons and graphics, but thanks to your help I got the script down. I actually fixed my own problem after posted this last email. Have a great weekend. Erik On Jul 3, 2009, at 5:14 PM, Cesar Sanz wrote: Hello. I see you succed retrieving data using ajax, Which is the problem? ----- Original Message ----- From: "Erik R. Peterson" <eriks...@... To: jquery-en@... Sent: Friday, July 03, 2009 2:48 PM Subject: [jQuery] Need help on How to load content via AJAX in jQuery I found this script: http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/ I got it working, but it really looks bad in IE, along with erros. Any alternatives or sugestions? Here is my page: http://www.enaturalskin.com/needhelp.htm Many thanks. Erik
|