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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:20:18+00:00 2026-05-29T21:20:18+00:00

Here is what I have… function checkDB(code, userid) { $(#notice_div).html(‘Loading..’); $.ajax({ type: POST, url:

  • 0

Here is what I have…

function checkDB(code, userid)
    {
      $("#notice_div").html('Loading..'); 
      $.ajax({
      type: "POST",
      url: "<?php bloginfo('template_url'); ?>/profile/check_code.php",
      data: { code: code, userid: userid},
      //data: 'code='+code+'&userid='+userid,
      datatype: "html",
      success: function(result){

           if(result == 0)
            {
                $('#success').html( code + ' has been redeemed!');
                // alert('success');//testing purposes
            }
            else if(result == 2)
            {
                $('#err').html(  code + ' already exists and has already been redeemed....');
                //alert('fail');//testing purposes
            }else if(result == 1){
                $('#err').html(  code + ' redeem code doesnt exist');      
            }
            $("#notice_div").html(''); 
            //$('#originalquery').hide();
            //$('#mainquery').fadeIn('slow');
            //$("#originalquery").replaceWith($('#mainquery', $(html)));

            //alert(result);        
          }
      })

    }

This is on the same page as this:

   <?php

$sql="SELECT * FROM wp_scloyalty WHERE userid = '$user_id'";
$result=mysql_query($sql);
?> 
<table id="poo" style="margin:10px 0px 0px 0px;" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td><strong>Product</strong></td>
    <td><strong>Code</strong></td>
    <td><strong>Value</strong></td>
</tr>
<?php while($rows=mysql_fetch_array($result)){ ?>  
<tr>
    <td><? echo $rows['product']; ?></td>
    <td><? echo $rows['code']; ?></td>
    <td><? echo $rows['value']; ?></td>
</tr>  
<? } ?>
</table>


            <form method="post" class="sc_ajaxxx" id="sc_add_voucherx" name="sc_ajax" action="" onsubmit="checkDB(document.sc_ajax.sc_voucher_code.value, <?php echo $user_id; ?>); return false;">

            <button id="submit-code" type="submit" >Submit</button>

        </form>

This is the HTML…

When the ajax request is submitted, I want the table to automatically show the newly added information. I know why its not working but not sure how to get it to refresh. I assume refreshing the div isnt really possible as I would like it to be.. Im thinking about making a new query and bringing it in on success function?

Thanks 🙂

EDIT

The table query:

 <?php

$sql="SELECT * FROM wp_scloyalty WHERE userid = '$user_id'";
$result=mysql_query($sql);
?> 
<table id="poo" style="margin:10px 0px 0px 0px;" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td><strong>Product</strong></td>
    <td><strong>Code</strong></td>
    <td><strong>Value</strong></td>
</tr>
<?php while($rows=mysql_fetch_array($result)){ ?>  
<tr>
    <td><? echo $rows['product']; ?></td>
    <td><? echo $rows['code']; ?></td>
    <td><? echo $rows['value']; ?></td>
</tr>  
<? } ?>
<div id="newCode"></div>
</table>
  • 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-05-29T21:20:21+00:00Added an answer on May 29, 2026 at 9:20 pm

    so basically you want to pull the record from database based on $user_id and the resulting generated table needs to be shown on requesting page with ajax? Right?

    show the newly added information

    where’s it being added anyway?

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

Sidebar

Related Questions

I here have 3 <input> s in my HTML: Name: <input><br> Age: <input type=number><br>
enter code here I have a table on SQL server 2005 with bigint primary
something driver me crazy here i have a big HTML template which i can't
The below code is from my other questions that I have asked here on
does anyone here have a code snippet: how do I convert SDDL to SECURITY_DESCRIPTOR
I have an HTML page containing a flash file, I need to write code
So I here have such code I use to update CSS if browser supports
Just wondering what little scripts/programs people here have written that helps one with his
Since upgrading to 2008 I and many people here have noticed that randomly VS
Here I have: Public Structure MyStruct Public Name as String Public Content as String

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.