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
https://forums.phpfreaks.com/topic/241473-posting-method-problem/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.