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 8843831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:19:57+00:00 2026-06-14T11:19:57+00:00

I went through the code at the following two links: http://pastebin.com/iUd22CRY http://www.jensbits.com/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php Everything seems

  • 0

I went through the code at the following two links:
http://pastebin.com/iUd22CRY
http://www.jensbits.com/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php

Everything seems pretty clear in the code itself, but I can’t figure out the complete story of which codeblocks are associated with which filenames. Basically, I am trying to find an up-to-date guide to using jQuery’s post function for interactions with a PDO object, and I have been very unsuccessful in doing so.

What I plan to do next is attempt to convert/update an example from w3schools, if I cannot figure out what the filenames should be. Basically, with the pastebin, I think I know where the first three paragraphs of code go, but I have no idea where to place the javascript near the end. Before I slum, though, I was hoping someone would look over my code. Can you see the problem?

-Edit-
I have noticed an error via Chrome’s console (ctrl+shift+j in-browser): Uncaught SyntaxError: Unexpected token ; encode.js:17 http://ajform.99k.org/issues/semicolon/ or Uncaught ReferenceError: $ is not defined encode.js:1 http://ajform.99k.org/issues/orderofappearance/

Filesystem structure:

webroot/sitename/index.php; webroot/sitename/process_form.php; webroot/sitename/js/jquery-1.8.2.js; webroot/sitename/js/encode.js

index.php:

<!DOCTYPE html>
<html>
<head>
  <title>Tmp homepage</title>
  <script type="text/javascript" src="js/encode.js"></script>
  <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
</head>

<body>
<form id="ajform">
    <fieldset>
        <legend>jQuery.post Form Submit example</legend>
        <p>
            <label for="name">Name:</label></br />
            <input id="name" type="text" name="name" />
        </p>
        <p>
            <label for="email">email:</label></br />
            <input id="email" type="text" name="email" />
        </p>
        <p>
            <input type="submit" value="Submit" />
        </p>
    </fieldset>
</form>
<div id="post"></div>
</body>

</html>

encode.js:

$(document).ready(
  $(function(){
      $("#ajform").submit(function(e){    
         e.preventDefault();  

          $.post("../process_form.php", $("#ajform").serialize(),
          function(data){
              if(data.email_check == 'invalid'){

                      $("#post").html("<div class='errorMessage'>Sorry " + data.name + ", " + data.email + " is NOT a valid e-mail address. Try again.</div>");
              } else {
                  $("#post").html("<div class='successMessage'>" + data.email + " is a valid e-mail address. Thank you, " + data.name + ".</div>");
                  }
          }, "json");    
      });

  });
)

process_form.php:

<?php

$email_check = '';
$return_arr = array();

if(filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
   $email_check = 'valid';
}
else {
    $email_check = 'invalid';
}


$return_arr["email_check"] = $email_check;

if (isset($_POST['email'])){
    $return_arr["name"] = $_POST['name'];
    $return_arr["email"] = $_POST['email'];
}

echo json_encode($return_arr);

-Edit-
After working through the errors, thanks to answerers, the working version is at hhttp://www.jensbits.com/demos/jqsubmit/index.php.

  • 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-06-14T11:19:58+00:00Added an answer on June 14, 2026 at 11:19 am

    Your <script type="text/javascript" src="encode.js"></script> isn’t loading. It’s returning a 404.

    And, put encode.js AFTER the jquery js.

    View the source on the demo from my post that you cited. It will help you out.

    http://www.jensbits.com/demos/jqsubmit/index.php

    Thanks, BTW…

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

Sidebar

Related Questions

I went through this whole procedure http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx a couple weeks ago and got https
I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
I want to automate the testing of my GUI. I went through the following
I went through the following link which says that the external folders will be
When I read the nbody code in Cuda-SDK, I went through some lines in
I'm reading through the excellent online book http://nodebeginner.org/ and trying out the simple code
I went through source code of HashMap and have a few questions. The PUT
I'm using the following code to loop through a multidimensional array and find users
I have the following code: NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@one, @oneKey, @two, @twoKey,
I went through some tutorials on the State monad and I think I got

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.