derrida
asked on
how to refresh a jquery UI dialog after a form submitted?
Hi
i have a jquery ui dialog that open with a table of data from the database.
i also have a link that open another UI dialog with a form to add an item.
right now, when i press the submit button of the form i refresh the whole page and that is it. what i want is to refresh the first dialog when the submit button is pressed.
so when i add an item and press the submit: the form dialog is cloased and the dialog with the data display the refreshed data.
i add my ajax code for the form submition.
how can i get this to work?
best regards
i have a jquery ui dialog that open with a table of data from the database.
i also have a link that open another UI dialog with a form to add an item.
right now, when i press the submit button of the form i refresh the whole page and that is it. what i want is to refresh the first dialog when the submit button is pressed.
so when i add an item and press the submit: the form dialog is cloased and the dialog with the data display the refreshed data.
i add my ajax code for the form submition.
$("#devidersend").live('click',function(e){
e.preventDefault();
var devidertitle = $("#devidername").val();
var devidermenutype = $("select#devidermenutype option:selected").val();
var deviderlang = $("select#deviderlang option:selected").val();
// $("form#form-menu p.msg").remove();
//triger a click the current menu group.
$.ajax({
type: 'POST',
url: '/cms/addDevider/',
data:{
devidertitle:devidertitle,
devidermenutype:devidermenutype,
deviderlang:deviderlang
},
datatype: 'json',
success: function(data){
var theData = JSON.parse(data);
if(theData.type == 'errors'){
$("form#devideradding").prepend("<ul class='formalerts'>");
$.each(theData.message, function(key, value) {
$("form#devideradding ul.formalerts").append("<li> " + value + "</li>");
});
$("form#devideradding ul.formalerts").append("</ul>");
}else if(theData.type == 'missings'){
$("form#devideradding").prepend("<ul class='formalerts'>");
$.each(theData.message, function(key, value) {
$("form#devideradding ul.formalerts").append("<li>" +emptyfield+ ": " + value + "</li>");
});
$("form#devideradding ul.formalerts").append("</ul>");
}else {
window.location.href = '/';
$('div#adddevider').delay(5000).queue(function(){
$('div#adddevider').dialog("close");
});
}
},
beforeSend: function() {
$('form#devideradding').prepend("<p class='loadit' ></p>");
},
complete: function(){
$("p.loadit").fadeOut();
}
});
return false;
});
how can i get this to work?
best regards
ASKER
because as it stand now i have no idea how to refresh the dialog UI. once i`ll be able to do that i will not reload the page.
Do you have a page somewhere?
ASKER
hi
no its on my locqal machine.
but the issue is : where right now i do
window.location.href = '/';
to write a code that refresh the specific dialog.
no its on my locqal machine.
but the issue is : where right now i do
window.location.href = '/';
to write a code that refresh the specific dialog.
With the code provided I cannot help you solve your issue - I do not know what you mean by refreshing the UI dialog since I do not see it opened
ASKER
hi
think about a simple CRUD . lets say: user management.
when i press a "manage users" a jquery UI dialog is opened with a table of all the users and a link to add a new user. when this link is pressed a new jquery UI dialog is opened with a form for adding a user.
when this form is submitted i close the form dialog and i want to refresh the table of users in the table dialog.
think about a simple CRUD . lets say: user management.
when i press a "manage users" a jquery UI dialog is opened with a table of all the users and a link to add a new user. when this link is pressed a new jquery UI dialog is opened with a form for adding a user.
when this form is submitted i close the form dialog and i want to refresh the table of users in the table dialog.
So refresh dialog or table?
Can you make some screen shots?
Can you make some screen shots?
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
had no idea i can fake a click
thanks
thanks
Will reload the page. Why do you do that?