...

View Full Version : <div> refresh after form submission - a bug



grumpy
03-24-2011, 04:15 PM
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?


// 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:


$(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;
});
});

devnull69
04-14-2011, 11:09 PM
In this line you are using "uid" ... where is it defined? I don't see it in the first code piece


var dataString8 = 'ajax=1&uid=' + uid;

majeed
06-21-2011, 11:10 AM
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);" />



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum