php and javascript?

Posted on 2007-07-31
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
    LVL 24

    Accepted Solution

    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.
    LVL 4

    Author Comment

    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 for Beginning Beginners

    Are you looking for an efficient introduction to HTML5? Have you tried other HTML5 courses and found them too complex? Do you need just the basics of HTML5 to use with Wordpress or other content management system? If you said yes to any of these questions, this course is for you.

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now