Fancybox Jquery Form

Posted on 2010-05-14
Last Modified: 2012-05-09

I have a link to display a user form winthin a fancybox
a perl script gets the data from a database and populates a simple user form Name Contact info etc

on hiting update the same script updates the database & displays a Thank You message this works within a a seperate brouser window.
In the Fancybox window all that happens is the box closes and the parent window refreses and the datbase table remains untouched so i'm unable to tell what is happing because i can't get any message back

I'm using the example from


Attach FancyBox: 


	'scrolling'		: 'no',

	'titleShow'		: false,

	'onClosed'		: function() {




Simple validation; submit data using Ajax and display response

$("#login_form").bind("submit", function() {

	if ($("#login_name").val().length < 1 || $("#login_pass").val().length < 1) {



	    return false;




		type		: "POST",

		cache	: false,

		url		: "",

		data		: $(this).serializeArray(),

		success: function(data) {




	return false;


Open in new window

Question by:trevor1940
    LVL 15

    Expert Comment


                    type            : "POST",
                    cache   : false,
                    url             : "",
                    data            : $(this).serialize(),
                    success: function(data) {
    LVL 1

    Author Comment

     data: $(this).serializeArray(),
          data      : $(this).serialize(),

    didn't have any effect
    LVL 1

    Author Comment

    It has occerd to me that the example loads the form within the parent Document and then hides it I'm trying to load the form from an external perl script which is failing

    To load the form i use

    this Queries the Database and populates the form
    within the form there is an hidden input box with Switch = B

    this then tells the same perl script to up date the Database

    Is there a better way of doing this

    Thank you
    LVL 1

    Accepted Solution

    I managed to fix this by calling the child perl script into an iframe
    The examle works when the pparent document is a html doc it dosn't work when it is a perl script

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
    Introduction A frequently asked question goes something like this:  "I am runnning a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    678 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    32 Experts available now in Live!

    Get 1:1 Help Now