php and javascript?

Posted on 2007-07-31
Medium Priority
Last Modified: 2013-12-12
Just wondering if this is possible (just a idea that popped up in my head).

I currently have a system that you log into then depending on what you click it runs certain java script functions ok...

Is it possible to have when lets say they click on "Run Script" button it will have the javascript function run a php script thats located at a diffrent location? So I dont want it to change the pages just run the script that is on a diffrent page. If thats not possible how would I have it run a php script in the same page?

Again just wondering if its even possible, if so just a hint in the right direction is good enough help :)

Question by:aumudin
  • 2
LVL 24

Accepted Solution

glcummins earned 1000 total points
ID: 19603154
Yes, this is possible. You may have heard of AJAX (Asynchronous Javascript and XML). When your user performs a certain action, your Javascript creates a new backend request to your PHP script. That script is executed, and the results are returned in a suitable format (usually XML).

Search your favorite search engine for ajax tutorials for more information.

Author Comment

ID: 19604419
Yeah I have bought some books recently on AJAX just havnt had the time to read them to be honest. But alright ill end this question thanks for the input :)
LVL 24

Expert Comment

ID: 19604511
Getting started in AJAX can be a little daunting at first, but is well worth the effort in my opinion. You can build some rather interesting and appealing functionality into your sites, and create a more "natural" interface for your users. There are a number of AJAX toolkits and libraries available that will help you utilize the functionality quickly, but there is no substitute for just jumping in and learning the code directly.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question