I have an HTML page which contains a tree control on the left pane and
an IFrame on the rest of the page. Based on what I select on the tree
control, I update the content of the iframe. I am writing some error
handling code in which I am wrapping the jquery ajax object with error
handling such that if any error occurs, I want to display a dialog
with the error message sent from the server. The HTML page looks like
the following :
<html>
<head />
<body>
<div id='leftPane'></div>
<div id='pageContent'>
<iframe src='MyPage' />
</div>
<div id='topDialog' />
</body>
</html>
Then I am extending the jquery object to create a prompt
functionality. What it basically does is that it will check for a
"topDialog" div tag which exists in the main HTML page. If it can find
it (because the IFrame was loaded in a separate window) it will use
the "dialog" div that exists in the iframe's html content.
$.extend($.fn, {
Prompt: function(o) {
var dialog = $
(window.parent.document).find('#topDialog:first');
if (dialog.length == 0){
dialog = $('#dialog:first');
}
dialog.each(function(){
$(this).addClass('flora');
$(this).attr('title', o.title);
$(this).html(o.text);
$(this).dialog({
modal: true,
stack: true,
buttons: o.buttons,
close: o.close
});
});
}
});
Then I do something like :
$.ajax({
url: myurl,
success: onSuccess,
error : function(XMLHttpRequest, statusText, error){
$(this).Prompt({
title: "HTTPRequest Error!",
text: statusText
});
}
});
The problem that I am having with this is when the Iframe content
makes an ajax request and the server throws an error, the dialog is
being shown inside the Iframe and not inside the main page, even
though it called dialog() on "topDialog" instead of "dialog".
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---