Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 977643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:56:03+00:00 2026-05-16T03:56:03+00:00

I’m trying to create a simple AJAX uploader (as i know you can’t actually

  • 0

I’m trying to create a simple “AJAX” uploader (as i know you can’t actually do an AJAX upload). I’m having issues and i REALLY don’t want to use a plugin. I’m writing an app that needs to have PDF attachments as part of a form, and my app’s code is already at about 1000 lines of JS + jQuery. I don’t want to add on an extra 1000k of SWFObject or a giant form plugin. Plus, i like learning things so I know how they work 🙂 and i’m fairly proficient in JS as well…

Here is what I have so far:

<!DOCTYPE html>
<html>
    <head>
        <title>Upload Test</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script>            
            $(function(){
                $('#file_upload').submit(function(){
                    $('#file_upload').attr('target','upload_target');
                    alert($('iframe').contents().text());
                    return false;

                });
            });
        </script>
    </head>
    <body>
        Upload Test to 382
        <form id="file_upload" method="post" enctype="multipart/form-data" action="io.cfm?action=updateitemfile&item_id=382">
            <input name="binary" id="file" size="27" type="file" /><br />
            <input type="submit" name="action" value="Upload" /><br />
            <iframe id="upload_target" name="upload_target" src="" style=""></iframe>
        </form>

    </body>
</html>

I keep reading that if i add the target attr to a form the form will submit there, but no luck at all. It just doesn’t put anything in the iframe. The “action” attr will be dynamic based on what item is selected. If i turn off all the “AJAX” it works fine too, and i don’t have access to the backend as it’s an internal API.

So, how do I submit this to the iframe and then get the iframe’s content which will be a JSON response?

P.S. this is just a test page im working in… obv this isn’t the entire app.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:56:04+00:00Added an answer on May 16, 2026 at 3:56 am

    It’s not that the submit of the form populates the <iframe>. The POST should make it back to the server – are you seeing that? Then, the server response will end up in the <iframe>. Typically what you do in order to make it feel sort-of like Ajax is to have the response page contain some Javascript that talks back to the main page somehow.

    Stop returning false from your submit handler and see what happens.

    The point of doing this is to avoid the default behavior of form submission. When you submit a form in the plain old HTML way, the page containing the form is replaced by the response from the server. When you target the form at an <iframe>, however, it’s not. Instead the response is directed at the “page” inside the frame.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.