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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:58:46+00:00 2026-06-03T07:58:46+00:00

I am trying to edit a file on my server when a user clicks

  • 0

I am trying to edit a file on my server when a user clicks a button on my web page. I generate a table of buttons using php. STRING1, STRING2 and BOOL are variables I pass to my function. The editPlist() function I made is called and the test alert() shows. The problem is that the php file is to run. I am not getting any errors either. I can’t seem to figure out what is wrong.

Sample HTML button:

<a href="#" onclick="editPlist('STRING1', 'STRING2', 'BOOL')" class="buttong">1 : Round 1</a>

The button click runs this script: (the PHP in the url line generates the address of the file I want to run.)

<script type='text/javascript'>
function editPlist(stage, dance, oldValue)
{
    alert('test ' + stage + dance + oldValue);
    $.ajax({
        type: "POST",
        url: <?php echo '"'.dirname(curPageURL()).'/PlistEditorFunction.php"' ?>,
        data: {"var1" : stage , "var2" : dance , "var3" : oldValue},
        success: function(msg){
            alert( "Data Saved: " + msg ); //Anything you want
        }
    });
}

In the external php file PlistEditorFunction.php, I try to log a fake error and load the variables, but the error never shows. this is the beginning of the php file:

$msg = 'test error message';
error_log('['.date("F j, Y, g:i a e O").']'.$msg."<br /> \n", 3,  $phperrorPath);
if (isset($_POST['data']) and trim($_POST['data']) != '' ) {
    $stage = trim($_POST['var1']);
    $dance = trim($_POST['var2'])
    $oldValue = trim($_POST['var3']);
}

I know that the php script will only be run if the domain name matches file where the ajax is being run from. The two files are next to each other so I know that this isn’t the problem.

What can I do to fix this?

  • 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-03T07:58:48+00:00Added an answer on June 3, 2026 at 7:58 am

    After mwotton’s comment, I figured out that ajax was undefined. jQuery was imported, so that wan’t the problem. I found the answer was I had to change $.ajax to jquery.ajax.

    Some hosts don’t use “$” to denote jQuery. My web host uses “jquery” instead.

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

Sidebar

Related Questions

I'm trying to user RewriteRule in my .htaccess file to redirect example.com/page to example.com/page.php
My goal is to update the web page with some file. When I edit
In php, I'm trying to read a file that is placed above the web
I'm trying to delete an image file whenever a user clicks a link to
I have been trying to edit the jquery buttons in order to modify them
I'm trying to get edit text to behave in this way: User can input
I'm trying to retrieve image file from my local server. Here is my (very
My server uses suPHP and so each website has it's own php.ini file. My
I am trying to open a web page with a Silverlight App from a
I'm trying to use a PHP function to read a server directory for images.

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.