Viewing it's hard for this question to get more answers, I'll write what I've done for anyone searching for possible ways to achieve that.
The solution I've used
Finally, I've used JQuery load() function to load an external HTML page in which there's only the part I want to show.
Also, I've not used anymore the JQuery dialog() function as this gets the JQuery CSS styles, and I needed it to be completely integrated in my CSS scheme. Also, I wanted more control over the buttons. So what I've done is use the following custom function:
function show_user_control(target_control, parameters){
// target_control = the url we want to get the code from
// parameters = the parameters passed to the url, in a JSON format
/*
If we want to call this function and add event to its elements, perform some kind of actions when it finishes loading or call a function created within the external HTML, we will call it this way:
$.when(show_user_control("URL_TO_LOAD")).done(function(element){ --HERE GOES THE ACTIONS TO EXECUTE-- })
*/
return $.Deferred(function(){
var self = this
if(parameters === undefined) parameters = '';
var user_control
var parameters_url = "?"
if(parameters != ''){
parameters = JSON.parse(parameters)
$.each(parameters, function(key,par){
parameters_url += key+"="+par+"&"
})
}
parameters_url = parameters_url.substring(0, parameters_url.length-1)
$("body").append(
$('<div class="user_control_lock"></div>').append(
$('<div class="user_control"></div>').load(target_control + parameters_url, function(){
user_control = $(this)
user_control.center(true)
user_control.on(myDown, ".xlogout", function(){ // Add a global event, common to all the dialogs (if a span.xlogout is clicked, it's closed)
remove_user_control()
})
self.resolve(user_control)
})
)
)
})
}
function remove_user_control(target){
// target = the JQuery object reference to the User_Control we want to remove
if(target === undefined){
$(".user_control_lock").last().empty()
$(".user_control_lock").last().remove()
}else{
target.empty()
target.remove()
}
}
If anyone is interested too, the CSS applied to the general divs is the following:
.user_control_lock{
background: rgba(24,24,24,0.8);
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
z-index:9999;
}
.user_control{
z-index: 9999;
position:absolute;
}
The .user_control
div is centered via JQuery plugin center() JsFiddle sample.
Hope it helps someone. Also, corrections are accepted!
Kind regards.