Link to home
Start Free TrialLog in
Avatar of trevor1940
trevor1940

asked on

Fancybox Jquery Form

Hi

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 http://fancybox.net/blog


Javascript

Attach FancyBox: 
$("a#UsrFrm").fancybox({
	'scrolling'		: 'no',
	'titleShow'		: false,
	'onClosed'		: function() {
	    $("#login_error").hide();
	}
});
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) {
	    $("#login_error").show();
	    $.fancybox.resize();
	    return false;
	}

	$.fancybox.showActivity();

	$.ajax({
		type		: "POST",
		cache	: false,
		url		: "UsrForm.pl",
		data		: $(this).serializeArray(),
		success: function(data) {
			$.fancybox(data);
		}
	});

	return false;
});

Open in new window

Avatar of StealthyDev
StealthyDev

Try

        $.ajax({
                type            : "POST",
                cache   : false,
                url             : "UsrForm.pl",
                data            : $(this).serialize(),
                success: function(data) {
                        $.fancybox(data);
                }
        });
Avatar of trevor1940

ASKER

senthurpandian:
changing
 data: $(this).serializeArray(),
to
      data      : $(this).serialize(),

didn't have any effect
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 UsrForm.pl?userid=1234&Switch=A

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
ASKER CERTIFIED SOLUTION
Avatar of trevor1940
trevor1940

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial