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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:23:09+00:00 2026-06-14T19:23:09+00:00

When a user clicks on a link, I want to move the files from

  • 0

When a user clicks on a link, I want to move the files from one folder to another (by ajax)

The php move file works fine, but the ajax part doesnt seem to be working.

Ajax called in JS script:

    function moveFiles() {
        $.ajax({
            url: "http://localhost/website/controller/moveFiles",
        });
    }

(Cake)PHP function

public function moveTmpFiles() {
    $source = new Folder(WWW_ROOT . "uploadify/tmpFiles");
    $unsavedFiles = new Folder(WWW_ROOT . "uploadify/unsavedFiles");
        $this->moveFiles($source->path, $destination_path->path);
}

JQuery function

$( "#element" ).click(function(event){
    event.preventDefault();
    moveTmpFiles();
    $( "#myDialog" ).dialog( "open" );
});

I guess I should add more options to the $.ajax call, but the real questions here is this:

Which options on jquery ajax calling are necessery to get it work?

  • 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-14T19:23:10+00:00Added an answer on June 14, 2026 at 7:23 pm

    You have a JS function named moveFiles() and you’re calling moveTmpFiles();, which is the PHP function.

    Change your jQuery function as follows.

    $( "#element" ).click(function(event){
        event.preventDefault();
        moveFiles();
        $( "#myDialog" ).dialog( "open" );
    });
    

    As a side note, do not use absolute paths. When you move your application to the production server, you’ll have to change all the URLs in your code.

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

Sidebar

Related Questions

Use case: user clicks the link on a webpage - boom! load of files
My app should render html, to answer when a user clicks ajax-link. My controller:
When the user clicks on a link to generate report I make an AJAX
I want to detect when user clicks a link in iframe and changes the
I want to have a sliding door effect, where the user clicks a link
I want to perform a simple AJAX get request when a user clicks a
I'm trying to load some stuff using AJAX when a user clicks a link,
If the user clicks a link, I want to call a Javascript function if
After the user clicks a link, I want to load the corresponding page within
Here is what I want to happen: The user should click a link/button that

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.