Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-24-2011, 03:15 PM   PM User | #1
grumpy
Regular Coder

 
grumpy's Avatar
 
Join Date: Oct 2006
Location: Visible light spectrum
Posts: 120
Thanks: 5
Thanked 6 Times in 6 Posts
grumpy is an unknown quantity at this point
Question <div> refresh after form submission - a bug

Hi,

The code below in red should be to refresh a certain div on the page after a form has been submitted - this form lives on another page. The form submission and the success data #results is being outputed correctly, but the div is not refreshing. This div refreshes correctly with a similar code within another function, but not within this one. Any suggestions?

Code:
// ask for validation on monitor delete, pause, resume request
$(document).ready(function(){
		$("#mondelpau").validate({
			debug: false,
			rules: {
				act: "required",
				uid: "required",
				sid: "required",
			},
			/*messages: {
				name: "Please let us know who you are.",
				email: "A valid email will help us get in touch with you.",
			},*/
			submitHandler: function(form) {
				// do other stuff for a valid form
				$.post('delpaures.php', $("#mondelpau").serialize(), function(data) {
					// refresh the monitor list div
					var dataString8 = 'ajax=1&uid=' + uid;
				     $.ajax({
				    	 type: "GET",
				    	 url: "monpanel.php",
				    	 data: dataString8,
				    	 success: function(html_data){
				    	 	$('#list_monitors').html(html_data);
				     	}
				     });
					
					$('#results').html(data);
					//alert (data);return false;
					
				});
			}
		});
	});
This is the function in which the same code works perfectly in refreshing the div:

Code:
$(function() {  
   $('.error').hide();  
   $(".button").click(function() {  
     // validate and process form here  
   
     $('.error').hide();  
       var domain = $("input#domain").val();  
        if (domain == "") {  
       $("label#domain_error").show();  
       $("input#domain").focus();  
       return false;  
     }  
        var com_domain = $("input#com_domain").val();  
         if (com_domain == "") {  
       $("label#com_domain_error").show();  
       $("input#com_domain").focus();  
       return false;  
     }  
		var cemail = $("input#cemail").val();
		var port = $("select#port").val();
		var active = $("input#active").val();
		var uid = $("input#uid").val();
		var main = $("select#main").val();
		
	 var dataString = 'cemail='+ cemail + '&domain=' + domain + '&com_domain=' + com_domain + '&active=' + active + '&main=' + main + '&port=' + port;  
	 //alert (dataString);return false;  
	 $.ajax({  
	   type: "POST",  
	   url: "user_add.php",  
	   data: dataString,  
	   success: function() {  
	     $('#monitor_form').append("<div id='message'></div>"); 
	     $('#monitor_form form')[0].reset();
	     $('#message').html("<img id='checkmark' src='images/tick.png' /><b> Monitor sucessfully added!</b>")  
	     .hide()  
	     .fadeIn(500, function() {  
	       $('#message').append("");  
	     });
	     setTimeout("$('#message').hide().remove();", 6000);
	     
		 var dataString2 = 'ajax=1&uid=' + uid;
	     $.ajax({
	    	 type: "GET",
	    	 url: "monpanel.php",
	    	 data: dataString2,
	    	 success: function(html_data){
	    	 	$('#list_monitors').html(html_data);
	     	}
	     });
		 //document.onkeydown = showDown;
	   }  
	 });  
	 return false; 
   });  
 });
__________________
A revolution in web-based apps and software for small business - Kissigy.com
grumpy is offline   Reply With Quote
Old 04-14-2011, 10:09 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
In this line you are using "uid" ... where is it defined? I don't see it in the first code piece
Code:
var dataString8 = 'ajax=1&uid=' + uid;
devnull69 is offline   Reply With Quote
Old 06-21-2011, 10:10 AM   PM User | #3
majeed
New to the CF scene

 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
majeed is an unknown quantity at this point
Post flex videoDisplay.totaltime is NaN -1

I am working on a project in which i am using videoDisplay component to load flv and its totaltime is NaN or -1. Can any one help on this?

private function videoDisplay_playheadUpdate(evt:VideoEvent):void {
progressBar.setProgress(evt.playheadTime, videoDisplay.totalTime);
trace(evt.playheadTime+" : "+videoDisplay.totalTime)
}


<mx:VideoDisplay id="videoDisplay" source="{VIDEO_URL}" width="100" height="100"
ready="videoDisplay.visible = true;"
metadataReceived="videoDisplay_metadataReceived(event);"
playheadUpdateInterval="50"
stateChange="videoDisplay_stateChange(event);"
playheadUpdate="videoDisplay_playheadUpdate(event);" />
majeed is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:31 AM.


Advertisement
Log in to turn off these ads.