Solved

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

Posted on 2015-02-16
2
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 12

Expert Comment

by:Nathan Riley
ID: 40612282
Should the slide only happen on the ajax success or should it slide on click?
0
 
LVL 12

Accepted Solution

by:
Nathan Riley 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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)
Suggested Courses

627 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