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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:58:41+00:00 2026-06-10T10:58:41+00:00

I need a way to use JavaScript to include/execute PHP (with ajax of course)

  • 0

I need a way to use JavaScript to include/execute PHP (with ajax of course) as if the file was native to the page. So I can use things such as GET requests etc.

<div id="firstAjaxDiv">Default Text</div>
<input id='buttonOneId' name="buttonOne" type="button" value="Do AJAX!"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$("#buttonOneId").click(function() {
    url = ('ajax_server.php');
    $.ajax({
        url: url,
        success: function(data) {
            if(data !="") {
                $('#firstAjaxDiv').html(data);
            }
        },
        error: function() {
            $('#firstAjaxDiv').html('It failed...');
        }
    });
});
</script>

Thats my file in which the Ajax happens. I am able to include the file and execute the php but it is as if I am including an iFrame, what I need is for the code to behave as if it were native to the page – this is because I will be handling GET requests if a user clicks on a link/button. How would I do this?

Thanks in advance!

  • 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-10T10:58:43+00:00Added an answer on June 10, 2026 at 10:58 am

    Ah! We meet again. 🙂 The code above will give you the code that seems native to the page. I think you are confused on how to populate it into the page. What is the response you are getting from the server file and how do you want it implemented into the page?

    To use a get request you can append your variables to the link like:

    ajax_server.php?variableName=someValue

    jQuery’s ajax defaults to a GET request which means you can just sling those variables into the url.

    Try something like

    var query = "input1=10&input2=20";
    url = ('ajax_server.php?'+query);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a way to use the jquery .live() function to act on elements
I need to find a way to use with(nolock) in every SELECT I do
I'm looking for a way to use your location to determine whether you need
Is there any way to use server controls in ASP.NET MVC? Specifically I need
I need to use the SharePoint API in the following way in a PowerShell
I need to use ajax feature to load an external div element (an external
Can anyone help me with a javascript regular expression that I can use to
I am creating a page which can play a video file with alternate plug-ins
In JavaScript, you can use Lazy Function Definitions to optimize the 2nd - Nth
I have a PHP application that makes extensive use of Javascript on the client

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.