This way, you submit everything to test.php via AJAX.In test.php you have access to the $_POST super-global in all its glory.You can then manipulate your data as you wish, then pipe it back to display in FancyBox.

Simples!

Forbes
—
2013-02-05T14:18:10Z —
#8

Okay, I'm nearly there. But there are a few problems:

I can't remove the loading icon, even when I delete the $.fancybox.showLoading(); attribute;

I can only send one parameter, and data: 's=' + s + '&' + 'e=' + e doesn't appear to work, in that only 's' is carried forward, while 'e' appears to be undefined, even though data is present prior to submission;

also, Fancy Box only works once, and no subsequent attempts result in a window.

Pullo, thanks for the help so far.

Pullo
—
2013-02-05T19:30:53Z —
#9

Good evening,

To your points:

Forbes said:

I can't remove the loading icon, even when I delete the $.fancybox.showLoading(); attribute;

Are you sure?This does it for me.Maybe you have extra code somewhere that is causing this?

Forbes said:

I can only send one parameter, and data: 's=' + s + '&' + 'e=' + e doesn't appear to work, in that only 's' is carried forward, while 'e' appears to be undefined, even though data is present prior to submission;

I find this surprising.This works for me:

data : 'firstName=' + firstName + '&lastName=' + lastName

I've updated my script at the bottom of this post for you totry it out.

Forbes said:

also, Fancy Box only works once, and no subsequent attempts result in a window.

Again, I find this surprising.I can call FB as many times as I like (see the example).

If I was you, I'd take a second to run the example I provide and see if your issues persist.If so, then there is a glitch in the Matrix, if not, then we have narrowed the problem down to your script.Either way, i would be interested to know how you get on.

Forbes
—
2013-02-05T20:42:44Z —
#10

Okay, there's an error somewhere in my code, which is responsible for 'e' not being passed along to FancyBox.

As for the loading graphic, I don't have anything else on the page that would do that; your code introduced that feature, and it's something I don't use anywhere in the application.

Also, your code relies on the newer version of FancyBox, which essentially disables every instance that uses code specific to the earlier version — of which there are many throughout the application.

Fun and games!

Pullo
—
2013-02-05T21:51:52Z —
#11

Forbes said:

Also, your code relies on the newer version of FancyBox, which essentially disables every instance that uses code specific to the earlier version — of which there are many throughout the application.

Just to be clear, your examples work perfectly. It's the integration with my application that's causing the problems, especially with the error in my code.

If you don't mind, I have to go, but I'll be sure to try tomorrow.

Pullo, thanks again.

Pullo
—
2013-02-05T22:40:41Z —
#13

No probs It can be quite annoying when you're looking for a solution to a complicated problem and you have to try and bring a stranger up to speed with your project.

Nonetheless, hopefully the last example I posted should help you implement the POST request correctly and route the response back to FancyBox.Let me know how you got on.

Cheers

Forbes
—
2013-02-06T09:43:01Z —
#14

Pullo, what does your 'e' variable do? I ask because that's the name of the variable I'm having problems with.

Pullo
—
2013-02-06T09:46:54Z —
#15

It represents the "click" event.As, in this example, the page to display in FancyBox is hard-coded into the "href" (i.e. test.php) we need to prevent the browser following that link.That's what this line does:

e.preventDefault();

HTH

Forbes
—
2013-02-06T09:56:39Z —
#16

Okay, I Googled the preventDefault() function, so understand what that does.

However, I simply don't know enough about JavaScript / jQuery (whatever it's called) to fix the bug in my code, or how to implement your code and have it work (I can't get Fancy Box to work reliably, other than using the code I'm using elsewhere, but won't work here in this exercise).

Because of the time constraints, I may have to abandon this exercise, largely because I honestly don't know what's going on, and this needs to be maintainable in the future.

Pullo
—
2013-02-06T10:13:03Z —
#17

That's a shame

If you can post a link to a page where I can see all of this in action, I don't mind taking a look.

Forbes
—
2013-02-06T10:27:42Z —
#18

Thanks for the kind offer. It's a commercial application, which requires sign in details, so I'll send you a private message with details for the development version.