Solved

How to add div.slideUp to my current Ajax/jQuery?

Posted on 2015-02-16
2
230 Views
Last Modified: 2015-03-04
Hi,

I got this jQuery/Ajax:

<script>

	$(document).ready(function() {
		$('#mount_tube_button').click(function(){
			$.ajax({
			
				url: 'conf_overview_handler.php',
				type: 'post',
				data: {'<?php echo $input_name; ?>':$('input[name=<?php echo $input_name; ?>]:checked').val()},
				success: function(msg){
					$('#mount_<?php echo $location; ?>_AJAX').html(msg);
				}
			
			}); // Ajax call
		}); //event handler
	}); //document.ready

</script>

Open in new window


How can I add this to it:
$( "#toggle_rod" ).slideUp( "slow" );

Open in new window


I have tried this, but it does not work:
<script>

	$(document).ready(function() {
		$('#mount_tube_button').click(function(){
			$.ajax({
			
				url: 'conf_overview_handler.php',
				type: 'post',
				data: {'<?php echo $input_name; ?>':$('input[name=<?php echo $input_name; ?>]:checked').val()},
				success: function(msg){
					$('#mount_<?php echo $location; ?>_AJAX').html(msg);
					$( "#toggle_rod" ).slideUp( "slow" );
				}
			
			}); // Ajax call
		}); //event handler
	}); //document.ready

</script>

Open in new window

0
Comment
Question by:kgp43
  • 2
2 Comments
 
LVL 11

Expert Comment

by:N R
ID: 40612282
Should the slide only happen on the ajax success or should it slide on click?
0
 
LVL 11

Accepted Solution

by:
N R earned 500 total points
ID: 40612297
http://jsfiddle.net/t4rzo8t7/

This shows the slide up command working when outside the success.  I imagine your ajax request is not succeeding and that may be why your slide up event isn't firing.  Keep in mind in my example I removed your php variables.

	$(document).ready(function() {
		$('#mount_tube_button').click(function(){
			$.ajax({
			
				url: 'conf_overview_handler.php',
				type: 'post',
				data: {'':$('input[name=]:checked').val()},
				success: function(msg){
					$('#mount__AJAX').html(msg);
				}
			
			}); // Ajax call
            $( "#toggle_rod" ).slideUp( "slow" );
		}); //event handler
	}); //document.ready

Open in new window

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now