SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Why this form won't submit?

    Hi guys

    I have created a form,
    http://coder9.com/jazportfolio/admin/admin2/add_record

    And when I press the 'save' button it won't submit/redirect to the path.

    I'm thinking maybe the jQuery codes is the culprit?

    Can someone give shed to this please.

    Thanks in advanced.
    Quality codes are optimized and tested...
    Click here for inspiration..

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Shouldn't you be including the jQuery Form Plugin somewhere in your page?

    Code:
    <script src="http://malsup.github.com/jquery.form.js"></script>

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I have already included.
    So why it's not redirecting?
    Quality codes are optimized and tested...
    Click here for inspiration..

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Quote Originally Posted by solidcodes View Post
    I have already included.
    Sorry, so you have.

    Quote Originally Posted by solidcodes View Post
    So why it's not redirecting?
    Why are you expecting it to redirect?
    The form is submitting, but you aren't doing anything with the response.

    AJAX typically involves sending HTTP requests from client to server and processing the server's response. This can take place without reloading the entire page (asynchronously).
    Javascript receives the data response from the server and can then do something with it (normally update the DOM dynamically).

    You can test all of this out if you create a PHP file called test.php and copy this into it.

    PHP Code:
    <?php 
    $arr 
    = array("message" => "The server says hello!");
    echo 
    json_encode($arr);
    ?>
    Then alter your form to submit to test.php:

    HTML Code:
    <form action="test.php" method="post" enctype="multipart/form-data" id="imageform">
    Then do something with the response:

    Code JavaScript:
    success : function ( json ) {
      alert(json.message);
    }

    Now when you submit your form, you at least see a response from the server, proving the plugin is doing what it should.

    I hope this helps.

  5. #5
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @pullo
    Thanks dude I'll try.
    Quality codes are optimized and tested...
    Click here for inspiration..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •