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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:45:52+00:00 2026-06-09T17:45:52+00:00

I am trying to send the contents of javascript file using file_get_contents. The problem

  • 0

I am trying to send the contents of javascript file using file_get_contents. The problem i’m having is the javascript contains some PHP variables:

<script>
jQuery('document').ready(function($){
    $('a.ajax_link').click(function(){
        $.ajax({
            type: 'DELETE',
            url: '/groups/$org_ID/leave/$member_ID',

            success: function(data){
                var data = $('<div>').html(data);
                var msg1 = data.find('#msg1');

                $('#data_box1').html(msg1).hide().fadeIn(500).delay(2000).fadeOut(500);
                setTimeout('window.location.href =\"/groups/\"',3000);
            }
        });

    });
});
</script>

Specifically, the url: line. That just stays as plain text and so my script fails. I now understand this is the behavior of file_get_contents but how can I go about doing this?

thanks!

  • 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-09T17:45:54+00:00Added an answer on June 9, 2026 at 5:45 pm

    Use output buffering and require:

    $org_ID = 5;
    $member_ID = 10;
    ob_start();
    require '/path/to/javascript_file.php';
    $js_code = ob_get_clean();
    

    Inside javascript file you’ll have to use php tags:

    url: '<?php echo "/groups/$org_ID/leave/$member_ID"; ?>'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying send an array to php file using $_POST ,still always getting an
I am trying to send a php script some content to be stored in
I am using node.js and trying send the .html file contains these tags: <meta
I have some simple text file. I am trying to read that file contents
Here is my javascript. I am trying to have jQuery send my sign in
I am trying to execute a javascript function from a PHP script by sending
I'm trying to send multipart/form-data with following JavaScript and jQuery: var formData = new
I'm trying to share some text using an intent: Intent i = new Intent(android.content.Intent.ACTION_SEND);
Trying to send some email in my C# app. I am behind a proxy
I am trying to send emails from smtps (secure smtp) using Indy and the

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.