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

  • Home
  • SEARCH
  • 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 8913093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:22:25+00:00 2026-06-15T04:22:25+00:00

Ok so I am trying to echo an function from jQuery inside of PHP.

  • 0

Ok so I am trying to echo an function from jQuery inside of PHP.

I was searching a little bit, I did not found any exact answer but I found that I need to use ajax for it ?

I am not familiar with ajax so I have found this.

<?php 
    $status = "<script>
                 $.ajax({ 
                    url: '/',
                    data: {action: 'test'},
                    type: 'post',
                    success: function(output) {
                       notifyBox();
                    }
                 });
               </script>";
?>

I also have this part somewhere on the page:

<?php if(isset($status)) { echo $status; } ?>

I am not quite sure if I need all of that to execute the function ?
But it works only if I put jQuery in head of the website.

I usually put all my scripts above </body> (at closing tag) and now it bothers me if I have to put all these scripts into head

Because of many pages I cannot separate all scripts now just cause of one page that bother me at the moment.

Can anyone please tell me, how do I call that function without getting console error of undefined ‘$’ because jQuery is loaded at the end of the page.

Thank you 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-15T04:22:26+00:00Added an answer on June 15, 2026 at 4:22 am

    That should work so long as you make sure that you put your PHP if statement after the <script> tag that includes jQuery.

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

Sidebar

Related Questions

i am trying to echo a html files contents from a php script. Quite
<?php echo(var answersC = answer-table-$qrow->id;); echo(var toggleC = toggle-table-$qrow->id;); ?> jQuery('toggleC').click(function() { jQuery('answersC').slideToggle('fast'); });
Im trying to encode some html within json from PHP. The function requests data
I'm trying to get the values from multiple textboxes using JQuery. I'm a bit
im trying to echo mediaplayer embed code with IF statement. is there any way
I am trying to echo a result from xml into my html code form
I am trying to echo a javascript alert message in php but I am
I'm not too sure what's going on here but I'm trying to echo a
Does anyone know how I can directly access a function from a PHP class
I'd like to pass content back and forth from PHP to jQuery and vice

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.