Reputation: 10483
I am using the latest and greatest version of jQuery.
When this button is clicked:
<input id="ShowImages" class="" type="button" value="images">
This function:
$("#ShowImages").click(function() {
$("#MusicianImagesDiv").load("MusicianImages.cfm?MusicianID="+MusicianID);
});
Loads a page into this div:
<div id="MusicianImagesDiv" class=""></div>
In that div, when this button is clicked:
<input id="MusicianImageUploader" type="button" value="launch image uploader">
This function pops up a window:
$("#MusicianImageUploader").click(function() {
MyURL = "GlobalAdmin/MusicianUploader.cfm?MusicianID=" + MusicianID;
window.open (MyURL, "mywindow","location=0");
});
When the "close window" button in the pop up window is pressed:
<input id="CloseButton" type="button" value="close this window">
I want to reload A SPECIFIC DIV // not the parent page
$('#CloseButton').click(function() {
// to be clear, this code is in the pop up window
// the MusicianImagesDiv div is in the parent window
$("#MusicianImagesDiv").load("MusicianImages.cfm?MusicianID="+MusicianID);
});
And then close the pop up window.
Everything works perfectly except for reloading the div when the close button is clicked.
What am I doing wrong? Why does the close button not tell reload the div?
Here's the tweaked code that works flawlessly!!!
$('#CloseButton').click(function() {
var MusicianID = $("#MusicianID").val();
var LoadPage = "GlobalAdmin/MusicianImages.cfm?MusicianID=" + MusicianID;
window.opener.$("#MusicianImagesDiv").load(LoadPage);
window.close();
});
Upvotes: 0
Views: 2498
Reputation: 25776
Have you tried accessing window.opener
? This gives you access to the parent window. So roughly the code would be
$('#CloseButton').click(function() {
window.opener.$("#MusicianImagesDiv")
.load("MusicianImages.cfm? MusicianID="+MusicianID);
});
Upvotes: 1
Reputation: 38147
It will not work - because the #closebutton is on a different window / html page - why does it need to be a new window that is opened - why can you not use a JQueryUI dialog ? that way everything is in the same page and the event will be handled
Upvotes: 0