Javascript / Flex Communication Use Case [need advice]

I have a web page with a flex component, the flex component is responsible for creating an image from custom inputs.

Once the image is ready, the user enters additional information in the HTML form and clicks the submit form button.

When this button is clicked, javascript calls a function on the flex components that returns the image data as a base64 encoded string.

Then with Jquery I am doing ajax POST to django view. The image data is encoded as a string in the "data" option of ajax POST.

As soon as django's response responds to the response, I either redirect with a Javascript request, or flashes any possible errors.

Is this the best way to achieve what I want to achieve? (sending form data + image to server immediately)

  • There is a multi-encoded part in some form when dealing with files, should I use it? with ajax? as?

Thank,

Greg

0


source to share


1 answer


Alternatively, you can send Flex base64 image data directly to the server and process the result. You can do this easily with the URLRequest class. You can check this to see if it affects client performance; my guess is that pushing a lot of data through ExternalInterface to Javascript can cause the browser to freeze.



Ultimately, while it sounds like this Flex app is just a small component on your overall page, so it makes sense to keep the Flex component responsibilities as small as possible and do it via AJAX, as you seem to be handling the rest your requests in the application.

+1


source







All Articles