Jump to content

Posting method problem


Andy11548

Recommended Posts

Right, its the same problem, but I know where the problem is, I believe.

 

If I use:

 

<script type="text/javascript">
     $(document).ready(function() {
          $('#memberResults').load('./includes/scripts/loadmembers.php').show();
          
          $('#memberInput').keyup(function() {
              $('#memberResults').append('a');
          });
     });
</script>

 

It works how the code says, to append the character 'a', each time a key is pressed.

 

However, this code doesn't.

 

<script type="text/javascript">
     $(document).ready(function() {
          $('#memberResults').load('./includes/scripts/loadmembers.php').show();
          
          $('#memberInput').keyup(function() {
               $.post('./includes/scripts/loadmembers.php', { member: form.member.value },
               function(result) {
                    $('#memberResults').html(result).show();
               });
          });
     });
</script>

 

This doesn't work with the 'html' part in <!DOCTYPE html.

 

Could someone please teach me another way to write the posting method in javascript?

 

Thanks,

Andy.

 

(PS, Sorry about the new post, but I've worked out what part is making the script not work and thought it'd be easier to make a new post, so that you can see, as many people don't bother looking at the last page for updates etc.)

Link to comment
Share on other sites

Right, I've some how, fixed the script through messing around with it, haha.

 

The new script is now this:

 

<script type="text/javascript">
     $(document).ready(function() {
          $('#memberResults').load('./includes/scripts/loadmembers.php').show();
          
          $('#memberInput').keyup(function() {
              var member = $('#memberInput').val();
              
              $.post('./includes/scripts/loadmembers.php', { member: member },
              function(result) {
                 $('#memberResults').html(result).show();
              });
          });
     });
</script>

 

Which works out exactly how I want it to :D.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.