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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:54:16+00:00 2026-06-16T00:54:16+00:00

I currently call a PHP script from javascript and return the json data. This

  • 0

I currently call a PHP script from javascript and return the json data. This works great from the client. I need to make the same call to the PHP script from inside another PHP file. Can this be done?

My current jquery call looks like this:

$.post('functions/get_testdata.php?type='+Type, function(data) {
   ....
});

From inside another PHP script I’d like to call:

'functions/get_testdata.php?type='.$type

I could just copy the contents of get_testdata to my other PHP page but I’d like to maintain just one code block for this.

Any thoughts or am I missing the obvious?

  • 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-16T00:54:17+00:00Added an answer on June 16, 2026 at 12:54 am

    Yes, You could use something like cURL to do what you want to do, however I would suggest that a better approach might be to encapsulate the logic on that page into a class or function. So that when you call that page you might do something like

    $type = $_GET['type'];
    
    $result = your_new_function($type);
    

    You could then call this new function (or class) from anywhere in your code and just pass it the parameter you want.

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

Sidebar

Related Questions

I am currently learning how jplayer works. and I've encountered this code <script type=text/javascript>
I currently call a function to filter some HTML in PHP like this FilterHTML($string)
I have a javascript code making an Ajax call to a php script. The
I have a php script which processes xml returned from an api call. What
Currently, I have a Javascript file (running on the client) that I call a
I am currently translating a PHP script from a PHP server of version 5.4
Currently, I'm using setInterval to run several AJAX functions that call PHP pages like
Currently in my PHP-based applications I use a file, for instance services.php and call
I currently have a need for a custom ListViewItem class - let's call it
I'm currently trying to register a JS function call from a .NET page which

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.