Results 1 to 4 of 4

Thread: Loading a Form with Ajax

  1. #1
    Join Date
    Nov 2006
    Location
    Washington State
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Arrow Loading a Form with Ajax

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm

    3) Describe problem:

    I have a form on my website that loads on an ajax loaded page. I want to be able to submit my form in that same ajax square. I tried putting the following code in there but it would not work.
    HTML Code:
    <form action="javascript:ajaxpage('../mypage.php?id=785545678', 'ajaxBox')" method="post">
    When you click the submit button, nothing happens. Does anyone know how to do this?
    Last edited by portkey; 03-01-2007 at 08:15 PM. Reason: Include HTML code

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Not sure if this will work or not, but instead of using the action attribute, try using the onsubmit attribute. This will look like the following:

    Code:
    <form method="post" onsubmit="ajaxpage('../mypage.php?id=785545678', 'ajaxBox');">
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Nov 2006
    Location
    Washington State
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    So I tried this and the form submitted, however it submitted to the entire page, and the page reloaded. I'm assuming this is because I have no "action" tag, and I believe the default "action" is the current page that you are on.

  4. #4
    Join Date
    Nov 2006
    Location
    Washington State
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    alright, so I found a solution for this problem outside of DynamicDrive and it works great! In case anyone would like to see:

    http://julian.empiregn.com/2005-11/E...forms_to_AJAX/

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
  •