Problems closing a fancybox form upon submission
I've looked through several similar queries on this site but the usual solution (ie. parent.$.fancybox.close(); )has worked.

I am trying to get forms working using fancybox.

I am having problems closing a fancybox form and refreshing the parent page on clicking submit. My form data is getting posted to the database but the form won't close or refresh parent. 

My Firebug console is saying 

`$.fancybox is undefined`
`$.fancybox.close();`


Here is the code in the parent.

    <script type="text/javascript" >
    $(document).ready(function() {
    
    	$("a.change_number").fancybox({
    		'transitionIn' : 'elastic',
    		'transitionOut' : 'elastic',
        	'scrolling'		: 'no',
    		'titleShow'		: false,
    		'frameWidth'	:	300,
	     'frameHeight' 	:	170
    	
    	});
    });	
    </script> 

Here is the link that calls it: 

`<a class="change_number fancybox.iframe" href="invnumber_form.php">Change Format</a>`

And this is the ajax to post the form data to my database.

    <script>
    $(function(){
    	$("form#invnumber_form").submit(function() {

    		$.ajax({
    			type : "POST",
			    url : "proc_invnumber.php",
			    data : $(this).serializeArray(),
			    success: function(data) {
				    $.fancybox.close();
				    // have also tried parent.$.fancybox.close(); as it is an iframe
				    parent.location.reload(true);
			    }
		    });

		    return false;
	    });
    });		
    </script>



Even this doesn't work:

    <script>
    $(function(){

	    $("#target").click(function() {
	      $.fancybox.close();

    });		
   </script>

`<a href="" id="target">Click to close</a>`

Which is making me think it is not the form that is at issue.

And I am including jQuery and fancybox all OK further up.

Do I have to do this using an iframe? It is opening in a new FF tab when I remove the iframe from the fancybox.iframe in the calling link. I really want the fancybox form data to be displayed on the parent page after submission so if I can do it without an iframe that might be better.

*thoroughly confused*

Many thanks for any help.



Problems closing a fancybox form upon submission
===

I've looked through several similar queries on this site but the usual solution (ie. parent.$.fancybox.close(); )has worked.

I am trying to get forms working using fancybox.

I am having problems closing a fancybox form and refreshing the parent page on clicking submit. My form data is getting posted to the database but the form won't close or refresh parent. 

My Firebug console is saying 

`$.fancybox is undefined`
`$.fancybox.close();`


Here is the code in the parent.

    <script type="text/javascript" >
    $(document).ready(function() {
    
    	$("a.change_number").fancybox({
    		'transitionIn' : 'elastic',
    		'transitionOut' : 'elastic',
        	'scrolling'		: 'no',
    		'titleShow'		: false,
    		'frameWidth'	:	300,
	     'frameHeight' 	:	170
    	
    	});
    });	
    </script> 

Here is the link that calls it: 

`<a class="change_number fancybox.iframe" href="invnumber_form.php">Change Format</a>`

And this is the ajax to post the form data to my database.

    <script>
    $(function(){
    	$("form#invnumber_form").submit(function() {

    		$.ajax({
    			type : "POST",
			    url : "proc_invnumber.php",
			    data : $(this).serializeArray(),
			    success: function(data) {
				    $.fancybox.close();
				    // have also tried parent.$.fancybox.close(); as it is an iframe
				    parent.location.reload(true);
			    }
		    });

		    return false;
	    });
    });		
    </script>



Even this doesn't work:

    <script>
    $(function(){

	    $("#target").click(function() {
	      $.fancybox.close();

    });		
   </script>

`<a href="" id="target">Click to close</a>`

Which is making me think it is not the form that is at issue.

And I am including jQuery and fancybox all OK further up.

Do I have to do this using an iframe? It is opening in a new FF tab when I remove the iframe from the fancybox.iframe in the calling link. I really want the fancybox form data to be displayed on the parent page after submission so if I can do it without an iframe that might be better.

*thoroughly confused*

Many thanks for any help.


