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

  • SEARCH
  • Home
  • 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 6678999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:18:30+00:00 2026-05-26T04:18:30+00:00

I am using the AjaxForm() call from jquery.form.js to attempt to run a php

  • 0

I am using the AjaxForm() call from jquery.form.js to attempt to run a php script that will put data into the data base and then pull it out. But how would you make that call using the ajaxForm call from jquery.form.js?

*UPDATE: ADDED SOME CODE *

    $('#profilepicbutton').live('change', function(){
    $("#preview").html('');
    $("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
        $("#registerpt3").ajaxForm({target: '#preview'}).submit();
        /*$.post(
        "register3.php",{
            target:'#preview'},
            function(data){*/
                $("#preview").html('');
                $("#preview").append("<img src="+data+"></img>");
 });

My PHP code…

    if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
    {
  $name = $_FILES['profilepicinput']['name'];
  $size = $_FILES['profilepicinput']['size'];
  if(strlen($name))
  {
    list($txt, $ext) = explode(".", $name);
    if(in_array($ext,$valid_formats))
    {
        if($size<(1024*1024)) // Image size max 1 MB
        {
            $actual_image_name = time().$session_id.".".$ext;
            $tmp = $_FILES['profilepicinput']['tmp_name'];
            $fp      = fopen($tmp, 'r');
            $data = fread($fp, filesize($tmp));
            $data = addslashes($data);
            fclose($fp);
            if(mysql_query("insert into Personal_Photos (Email, Pics) values('$email', '$data')"))
            {
                $query="select Pics, MAX(ID) from Personal_Photos where Email='$email'";
                $result=mysql_query($query) or die("Error: ".mysql_error());
                $row=mysql_fetch_array($result);
                header("Content-type: image/jpg");
                print($row['Pics']);
            }
            else
            {
                die('Invalid query: ' . mysql_error());
                echo "failed";
            }
        }
        else
            echo "Image file size max 1 MB. Image Size:"+$size;
    }
    else
        echo "Invalid file format..";
}
else
    echo "Please select image..! Bull shit".$email;
exit;

}

So you are saying that the data should come right back auto-magically?

When I call ajaxForm should I call a function?

UPDATE: Request for an example

hello there. I don’t want to be that dude that is constantly asking for example code, but does any body have an example of making an ajaxForm() call and successfully getting data back and posting it to there page? I can’t figure out what to do… What I just tried is

$('#profilepicbutton').live('change', function(){
    $("#preview").html('');
    $("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
        $("#registerpt3").ajaxForm({
                target: '#preview',
                success: function(data)
                {                                   
                    $("#preview").html('');
                    $("#preview").append("<img src="+data+"></img>");
                }
            }).submit();
 });

When I use firebug to figure out what is in data, it is telling me that it is undefined. Really confused. Please help.

  • 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-26T04:18:31+00:00Added an answer on May 26, 2026 at 4:18 am

    You simply do: $('#myFormId').ajaxForm(); and it should auto-magically work 🙂
    You can pass any of the standard $.ajax options to ajaxForm (complete and success callbacks, etc).

    You can see the complete docs here: http://jquery.malsup.com/form/#getting-started

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

Sidebar

Related Questions

I have a page that has a form using this ajaxForm jQuery plugin .
I'm using JQuery Form Plugin as follows: $('document').ready( -> options = beforeSubmit: markComment $('.comment_form').ajaxForm(options)
I'm using the Ajax Form jQuery plugin to get JSON from a server: /**
I'm using the jQuery form plugin to call a function before submitting the form.
I'm using the JQuery plugin AjaxForm (http://jquery.malsup.com/form/) to submit the contents of a form
I'm using the jQuery plugin ajaxForm to submit a file upload form via AJAX.
I want to encrypt some data in a form using jQuery before it's sent
I have file upload using jquery form plugin as $(function() { $(#Form).ajaxForm({ iframe: true,
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
Using ASP.NET MVC there are situations (such as form submission) that may require a

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.