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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:19:34+00:00 2026-06-02T03:19:34+00:00

the script I post works fine, it just execute in background my php code

  • 0

the script I post works fine, it just execute in background my php code at the load of the page.. What I cannot do is to start the php in background after having pressed a submit button.. I tried to add a form in the body but I don’t know how to link it with the ajax.. how could be done?
thanks!

<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>

<script type="text/javascript">
  $(document).ready(function() {
    $.ajax({
        url: 'trial.php',
        beforeSend: function() {
            // you could also put a spinner img or whatever here too..
            $("#myStatusDiv").html("started..");
        },
        success: function(result) {
            $("#myStatusDiv").html(result);
        }
    });
  });
</script>

</head>
<body>

</body>                                                                                                             

</body>                                     
</html>
  • 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-02T03:19:35+00:00Added an answer on June 2, 2026 at 3:19 am

    You are currently executing the code when the document is ready loading. You should add this code to the button click event.

    So instead of this:

    $(document).ready(function() {
        //your code
    });
    

    Do this:

    $(document).ready(function() {
        $('#buttonid').click(function() {
            //your code
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've put together a little script that works fine in general, it just needs
I'm using the post-receive-email script included with git. (Source is here .) It works
$.post('includes/script.php', $(this).serialize(), function(data) { $('body').append(data); }); alert ($('#new').length) php script is <php echo <div
Problem background I have a post-commit script for my SVN repository which archives &
I'm trying to read POST data in a PHP script. My first instincts led
When my PHP script receives data from an AJAX POST request, the $_POST variables
Ok, so this works fine for toggling one post on and off at a
Good Morning, I have a really simple script that works fine on everything but
Here is the code for the jquery: <script type=text/javascript> $(document).ready(function(){ $('#room').submit(function(){ $.post('backend/CreateRoom.php', $('#room').serialize() ,function(data)
I have got this script that works fine, that allows a user to vote,

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.