Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 2 AJAX calls affecting 1 loading graphic - How to stop?

    Hi all,

    I'm fairly new to posting for help on coding, so please bare with me, hope this makes sense!.

    See here: http://www.retainingsolutions.com.au/test

    You will see two forms on the page at the top. One is a subscribe form, the other is a real time 'apple-style' search engine.

    On their own, each feature works perfectly. In fact, they both work perfectly, however the search feature is affecting the subscription form.

    The subscription form uses an ajax submit using the jquery form plugin. While it's submitting, it displays a loading graphic in a div. It appears that this loading graphic starts up on ANY ajax call on the page - because when you start typing in the search field, it initiates the newsletter subscription loading sequence.

    Given my limited knowledge of how to customise this, I would be ever so thankful if someone could take a quick look at the following codes.

    First, here's the jquery script that handles the subscription form, you can see the top section is the ajax loading graphic handler. What I need to do is somehow modify it so it plays ONLY when the newsletter subscription ajax call is happening, and not when ANY other ajax call happens. Is there a way to make this function specific rather than global?

    Code:
    // form validation and ajax submitter.
    jQuery(function() {
    		// show a simple loading indicator
    		var loader2 = jQuery('<div id="loader2"><img src="images/contact/loader.gif" alt="loading..." /></div>')
    			.css({position: "relative", top: "0px", left: "0px"})
    			.appendTo("#subscribeConfirmation")
    			.hide();
    		jQuery().ajaxStart(function() {
    			loader2.show();
    			$('div#newsletterBox').fadeOut();
    		}).ajaxStop(function() {
    			loader2.hide();
    		}).ajaxError(function(a, b, e) {
    			throw e;
    		});
    		
    		var v = jQuery("#subscribeForm").validate({
    			submitHandler: function(form) {
    				jQuery(form).ajaxSubmit({
    					target: "#subscribeConfirmation"
    				});
    			}
    		});
    	});
    Put simply, I don't want the loading graphic for the subscribe form to be initiated when a user is typing in the search field.

    Appreciate anyone's time who looks at this.

    Kind Regards

    Scott

  • #2
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wondering if anyone here could possibly help me out? It's the final thing I need to fix on the site so it's finished!

    Many thanks,

    Scott

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts
    Quote Originally Posted by scottrichardson View Post
    Wondering if anyone here could possibly help me out? It's the final thing I need to fix on the site so it's finished!

    Many thanks,

    Scott
    just a suggestion, i think its jquery problem and you can ask the moderator to shift your thread in jquery section.

    may be you will get some answer there.

    vineet

  • #4
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh snap, thanks mate. I'll get them to move it!

    Cheers,

  • #5
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    well i see the loader div in the newsletter div....

  • #6
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi there,

    Yes thats correct. It is MEANT to be there... however, when using the search, it also activates the loader div and its related javascript function. I don't want my search box making the loader div appearing.

    Is there a way to make that ajax loading div function ONLY appear when using the newsletter subscribe?

    Cheers,


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •