how open a dialog with the content from http response
Hi,
When I click on a link, I post a request to the server and I get a response sent to ""myProfile.jsp". I want to open a dialog with the content of "myProfile.jsp" in it, just as I would open "myProfile.jsp" in a new window.
I tried the code below and it does not work. I tried different combinations, but I either get an ampty dialog or I get the page content of "myProfile.jsp" inside the parent page where <div id="fragment-3"> is.
Here is the code from my jsp
====================
<a title="Profile" href="#fragment-3" id="permit"><span>Profile</span></a>
<div id="fragment-3"> <!-- Profile content -->
<div id="myDialog" class="flora" title="My Profile dialog" >
<jsp:include page="myProfile.jsp"/>
</div>
</div>
$(document).ready(function() {
<!-- This dialog will open when click on button -->
var dialogOpts = {
bgiframe: true,
modal: false,
height: "750px",
width:"650px",
draggable: true,
resizable: true,
autoOpen: false
};
$("#myDialog").dialog(dialogOpts);
<!-- End dialog -->
});
$("#myButton").click(function() {
$.ajax({
type: "POST",
url: "${pageContext.request.contextPath}/viewLocationUsers.htm",
data: "locationId=60345",
cache: false,
success: function(response){
$('#fragment-3').html(response);
$("#myDialog").dialog("open");
}
});
});