I've been reading a variety posts, looking at code examples, and still
not able to wrap my head around getting results returned from the
server. So, if anyone has the time to answer this, please assume I
know very little.

Here's what does work:

I have a webpage that references three scripts: my custom code,
jquery, and jquery.form.

                <script src="script.js"></script>
                <script src="jquery.js"></script>
                <script src="jquery.form.js"></script>

When the user requests, my script dynamically generates a form (that
isn't on the page with the document loads) and so, after generating
the form, I manually call the Ajax handler with the form name.

        // Set Ajax form handlers
        $('#imageUploader1').ajaxForm(function() {
                alert("The image has been received.");
        });

This works perfectly. My image is uploaded, the page doesn't refresh,
and the alert appears.

When the image is received, my php script reduces its size and gives
it a new name.

Like I said, all of that is working perfectly. Here's what I'm trying
to get working:

I want the PHP script to return the server-assigned name to my local
javascript. That way, I can display the uploaded photo on the web page
(to verify the upload and because it's a nice effect).

I tried using success: and calling a function, etc., etc., but
apparently I'm doing it incorrectly. Plus, I'm not quite sure how the
PHP script should be generating its resullt. In the old days, I'd have
it echo the result. I've tried that, tried using return, and tried
setting a variable.

I assume there's a very simple method that I'm unaware of, so if
someone has the time to direct a novice with a few specifics, that
would be greatly appreciated.

Thanks.

Reply via email to