спасибо, ребята. только что отсортировано с плагином ниже!
http://malsup.com/jquery/form/#getting-started
окончательный код,
this.postForm_ask = function(){
$('#form_qna_ask').submit(function() {
var processing = $('#q-n-a .processing');
processing
.css({
margin:"0px 0px 0px -80px",
position:"absolute",
visibility:"visible"
});
processing.html('<div><p><img src="'+http_root+img_global+'loader-2b.gif"/> loading</p></div>');
$(this).ajaxSubmit({
target: '#output',
// dataType identifies the expected content type of the server response
dataType: 'xml',
// success identifies the function to invoke when the server response
// has been received
success: processXML_ask
});
return false;
});
}
this.processXML_ask = function(xml){ // == function addMessages(xml) {
var processing = $('#q-n-a .processing');
processing.css({
visibility:"hidden"
});
$(document.body).append("<div id=\"popup_result\" class=\"popup\"></div>");
var target = $('#popup_result');
var scrollTop = $(window).scrollTop();
var scrollLeft = $(window).scrollLeft();
var width = 400;
var top = 200;
var marginLeft = "-"+ ((scrollLeft + width)/2);
target
.css({
top:(scrollTop + top) + "px",
left:"50%",
marginLeft:marginLeft + "px",
width:width + "px",
zIndex:"11",
display:"none"
});
target.load(http_root+inc_layout+"result.php", {}, function(){
$("error", xml).each(function(){
var elementid = $(this).attr('elementid');
var message = $(this).attr('message');
//alert(elementid);
$("#"+elementid+"_label").addClass('error-qna');
$(".result").append("<img src='"+http_root+img_global+"attention.png' /> <b>" + message + "</b> <br />");
target.fadeIn('slow', function(){
closePopup(target);
//$('form *[title]').inputHint();
});
});
$("result", xml).each(function(){
var message = $(this).attr('message');
$(".result").append("<img src='"+http_root+img_global+"info.png' /> <b>" + message + "</b> <br />");
target.fadeIn('slow', function(){
closePopup(target);
clearFormElements('form');
$('.form *[title]').inputHint();
$('input:file').MultiFile('reset');
});
});
});
}