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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:54:34+00:00 2026-06-06T22:54:34+00:00

I am executing an AJAX request using jQuery as such: $.get({ url: ‘run_program.php’, data:

  • 0

I am executing an AJAX request using jQuery as such:

$.get({
          url: 'run_program.php',
          data: 'action=run&number=' + $('#number').val(),
          success: function (j) {
            alert(j);
          }

runprogram.php is as such:

<?php
if(isset($_GET['action']) && !empty($_GET['action'])) {
    run($_GET['number']);
}

function run($number) {
    echo shell_exec('program.exe $number');
}
?>

The response I get from the server is always 0. I am running this locally by the way, so there are no security problems. The program is simply coded to square the number passed in as input. It works perfectly fine in cmd. When I echo $number, it correctly gives the value that I passed in using jQuery. What is the problem in my code?

  • 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-06T22:54:35+00:00Added an answer on June 6, 2026 at 10:54 pm

    The problem would be your line

    echo shell_exec('program.exe $number'); 
    

    in that this will actually call program.exe with “$number” as text as a value. You need to use double quotes eg

    echo shell_exec("program.exe $number"); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following piece of JavaScript code, i'm executing GetData.php using AJAX. However, when
Using jQuery's $.ajax() function. Wherether the request has been purposely aborted, or if the
I am fetching 2 div's from a page using $.post jQuery AJAX request. Now
I'm developing a website using PHP+Ajax. I have to fire a ajax request that
Suppose I make an AJAX HTTP Request from jQuery to a backend PHP script.
I'm removing certain records using a webservice. The jquery ajax request is written in
I'm using jquery and php for some async job. I'm using $.ajax with beforesend
I'm using a form to record data in my database using AJAX. So, how
I am rendering ajax request for action where i am expecting to receive a
At the moment I'm using the post method like this $.ajax({ type: POST, url:

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.