Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript AJAX form not working…

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29407
    nchipping
    Member

    Hi,

    I’m trying to make an AJAX contact form for my first time, and right now – it’s very simple. I don’t have it doing anything right now, except for when someone submits something – it checks to see if they entered a name, and if they didn’t, it tells them to – that’s it.

    Anyway, for some reason, it’s not updating the page when I press the button after entering information into the form. If anybody could help me figure out what I’m doing wrong, I would really appreciate it. This is some of my first experience with AJAX/Javascript, so please, don’t hold back ;)

    Here’s the code for the form:

    Code:


    Name:
    Email:
    Comments:

    Your result will display here.


    And here’s the code for the PHP file, called send-form.php:

    Code:
    ‘;
    ?>

    Thank you in advance for your help!

    #78157
    Capt Otis
    Member

    Might I suggest JQuery? It is a javascript library that can make life easier, especially when it comes to simple ajax. It’s how I learned, and works in just about every browser you can think of.

    http://docs.jquery.com/Main_Page

    Ajax is on the left hand side on the menu for tutorials.

    I did what you want in only a minute with jquery, and notice how much shorter and forward it is. Easier to learn if you ask me.

    Code:


    Name:
    Email:
    Comments:

    Your result will display here.


    I know this isn’t exactly what you asked for, and if you want I will take a look at what you had and see if I can find your problem. Just note that if you use my example, you will need to have the jquery library and change the src to where it is on your server and also change the send form to receive a post instead of a get.

    Best of luck,
    -T

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.