javascript - Updating Div on Parent Page, preferably by use of jQuery -


i've used jquery's .html() function update content before, has been inside .ajax() function, example:

$.ajax({        padding : 15,        type    : "post",        cache   : false,        url     : "anypage.php?page=ajax",        data    : $(this).serializearray(),        success: function(data) {         $("#div").html(data);           }       }); 

problem is, in order utilize tinymce, had open in fancybox inside of iframe, ran problem of posting data, solved submitting form php $_get url (pretty sure that's not it's called), , closing fancybox:

<? if($_get['page'] == "x"){ $_session["x"] = $_post['x'];  echo '<script type="text/javascript">     parent.$.fancybox.close(); </script>'; die();} ?> 

that passes post variable session variable, can call inside main page. problem is, i'd refresh div on main page, , encountering problems.

i don't think can use .ajax(), @ least haven't had luck trying use it.

i've tried using different combinations of .html() , .load() .parent() , whatnot. couple examples of things i've tried (the others have been long since overwritten):

parent.document.getelementbyid("div").innerhtml = "something"; 

and

parent.$("div").html("some updated text"); 

inserted both follows:

echo '<script type="text/javascript">     parent.$("div").html("some updated text");     parent.$.fancybox.close(); </script>'; 

haven't found work. wondering if can lend me assistance.

if domains match, in iframe , parent document should able access parent using either of following:

window.parent parent top          // if parent top-level document window.top 

since parent , top can overwritten javascript go window.parent or window.top


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -