[eluser]jblack199[/eluser]
Okay so this is a LONG function in jquery so I'll post it
Code:
$('#cp').click(function() {
$.ajax({
url: $(this).attr('href'),
type: 'GET',
success: function(response) {
$('#popupCont').html(response)
$('#popup').dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
width: 400,
modal: true,
title: 'Change Password',
overlay: {
backgroundColor: '#000000',
opacity: 1
},
buttons: {
'Change Password': function() {
$.ajax({
url: $('#frmCPW').attr('action'),
type: 'POST',
data: $('#frmCPW').serialize(),
success: function(response) {
var obj = $.parseJSON(response);
if (obj.response == 'false') {
$('#popuperrDisplay').html(obj.msg);
$('#popuperrors').show();
} else {
[removed].href = obj.msg;
}
}
});
},
'Cancel': function() {
$(this).dialog('close');
}
}
})
$('#popup').dialog('open');
return false;
}
});
return false;
});
What this does, is when I click on the link who's id is cp, the script queries the href of the link, which is to obtain the HTML for the page to be loaded into the next step...
2nd step, is loads the HTML into the div, and then pops up the dialog... if the end-user clicks the button, it then queries the action of the form in order to do error checking and password updating...
Is this a plausible way of doing what I need it to do? Reason why i query the server first to get the HTML, is so that I can have a single <div> named popup for every popup on the entire site thus less HTML in the end (but more views)...