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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:57:10+00:00 2026-06-17T08:57:10+00:00

A page dslogin.php is loaded from a side panel into <div id=workarea> </div> The

  • 0

A page dslogin.php is loaded from a side panel into

<div id="workarea"> </div>  

The link which loads the page is very simple:

<a id=\"ds_action\" href=\"javascript:outputResults('dslogin.php','workarea','db=$k');\"> Connect to $k</a>

but when dslogin get $_GET[“db”] it generated a Form which shows up in the workarea div. Now the form is also simple :

function getCredentials($db,&$u,&$p)
{
echo "Connecting to Database $db: <br/>\n";
echo "<form id=\"dblogin\"  action=\"dsconnect.php\" method='post'> \n" ;
echo" Please enter your username and password if you wish. <br/> \n" ;
echo "Username: <input type='text' name='username' > \n " ;
echo "Password: <input type='password' name='password' > \n" ;
echo "<input type='submit' value='Login' name='Login'> <br/> \n" ;
echo "<input type='hidden' value=$db name='database'> <br/> \n" ;
echo "</form>" ;
echo "<div id=\"local\"> </div>";
}

Once the users submits the form, an ajax code supposed to intercept it in this following code

  <script>
 $(document).ready(function() 
 {
    $('#dblogin').submit(function() 
    { // catch the form's submit event
        $.ajax({ // create an AJAX call...
            data: $(this).serialize(), // get the form data
            type: $(this).attr('method'), // GET or POST
            url: $(this).attr('action'), // the file to call
            success: function(response) { // on success..
                $('#local').append(response); // update the DIV
            }
        });
        return false; // cancel original event to prevent form submitting
    });
    });
</script>

This is NOT working. My thinking is that when the page first loads with the ajax script:

$(document).ready(function() 
{
    $('#dblogin').submit(function()  ...

there is no link to the dblogin Form because it was not yet loaded.

When you click on submit, you get the action page dsconnect.php instead of getting the output of it appended to the form page as it supposed to do.

Is there a way to make this work?

  • 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-17T08:57:11+00:00Added an answer on June 17, 2026 at 8:57 am

    Change it to a delegate event:

    $('#{containerid}').on('submit', '#dblogin', function()  ...
    

    I think the container in you case is #workarea though it’s wasn’t so clear.

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

Sidebar

Related Questions

My page loads a TextView which is scrollable. Unfortunately the position appears to stick
Page is refreshed every 5 seconds. Images that received from .php file are appended
page: http://jsbin.com/eniva4/edit I have one main div: #main-content which contains two div's : #announcement
Page 1 <html> <head> <script src=jquery-1.8.3.js type=text/javascript></script> </head></head> <body><div id=main></div> </body> <script>$('div[id=main]').load('page2.php') $('span[id*=temp]').on('click',function(){ alert(this.id);
My page loads a random background image every time it loads: <?php $input =
My page has a <div> that echos a book script fed from database. The
Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div
Page is loaded with a hidden select box in it. I click on a
Page in question: http://secantmedical.com/biomedical-textiles/biomedical-textiles.php The heading area with the words Biomedical Textiles is set
This page , which implements a JavaScript-based online solver for Freecell, does not work

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.