« Return to Thread: Need help on How to load content via AJAX in jQuery
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
« Return to Thread: Need help on How to load content via AJAX in jQuery
| Free embeddable forum powered by Nabble | Forum Help |