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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:45:01+00:00 2026-06-10T10:45:01+00:00

Bit by bit I’ve been converting a PHP web app I’m working on to

  • 0

Bit by bit I’ve been converting a PHP web app I’m working on to Jquery AJAX form submits.

The current one I’m working on is for removing table rows. I think it’s a problem with my javascript, because it keeps doing a page refresh even with return false;. This was the problem with my form which creates an object, but thanks to some help from this site, I got that sorted and it now works fully.

Here’s my javascript:

$("form#table_customer").submit(function() {
        var query_string = 'page=customer&rows=';

        $(":checked").each(function() {
            query_string += this.value + "-";
        });

        $.ajax({
            url: "inc/deletesql.php",
            type: "POST",
            data: query_string,
            cache: false,
            success: function(data){
                $('#maincontent').load('inc/showObjects.php?o=customer');
            }
        });
        return false;
    });

The PHP file (deletesql.php) works with normal POST submits. But I just can’t seem to get it working posting the data through ajax.

You can see it in context at http://www.sfyfe.com/studioadmin/index.php?i=customer

  • 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-10T10:45:02+00:00Added an answer on June 10, 2026 at 10:45 am
        $('#maincontent').load('inc/showObjects.php?o=customer');
        ...
        // at this point form#table_customer doesn't exist yet in the DOM
        // so this binding a handler will give no effect
        $("form#table_customer").submit(function() {
               ....
        });
    

    Try this instead:

     // make the load reusable
    
     function addDeleteHandler() {
         // handle the load event
         // attach the event handler everytime the content is loaded, 
         // and the form#table_customer is added to the dom
         $('#maincontent').load('inc/showObjects.php?o=customer', function() {
             $("form#table_customer").submit(function() {
    
                 var query_string = 'page=customer&rows=';
    
                 $('input[name="checkbox"]:checked').each(function() {
                    query_string += this.value + "-";
                 });
    
                 $.ajax({
                     url: "inc/deletesql.php",
                     type: "POST",
                     data: query_string,
                     cache: false,
                     success: function(data){
                       addDeleteHandler();
                     }
                 });
    
                 return false;
              });
          });
      }
    
      addDeleteHandler();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

bit of a strange one... when my app is running I add a custom
Bit stuck about how to go about this one. Given the current month, I
Bit of a newbie when it comes to android, only been working on it
Bit of a newbie question here. I have a form and one of it's
Bit of a tough one to explain here, but I'll do my best. I
Bit of a random one, i am wanting to have a play with some
bit of a curly one here let me know if you have any ideas..
Bit of a strange problem here... I've got an update query that isn't working,
Bit of a weird one this. I'm rendering datasets on a map and need
Bit confused with this one. Basically, I have a column in a table, and

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.