Good JS/Ajax Libraries - and running PHP functions from Ajax.

Discussion in 'JavaScript' started by blueparukia, Feb 9, 2008.

  1. #1
    1.Can someone please help me with finding a good, powerful JS/Ajax library. I really like the look of MoTools, but can't find out how to use it. I was looking at something (I think it was drag and drop) and it said stuff about elements.js - only 1 js file was included in the download, and it wasn't elements.js.

    So if someone could give me instructions on proper download and setup, that would be appreciated.

    2. How can I execute a PHP function() in a file from the Ajax?

    Cheers,

    BP
     
    blueparukia, Feb 9, 2008 IP
  2. Zeldinha

    Zeldinha Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    1.- You could use jQuery and it's library, jQuery UI.

    http://jquery.com
    http://ui.jquery.com/

    It's easy to use, there are good tutorials on the wiki and many plugins that might already do what you want.

    2.- What is usually done is to call a PHP file through AJAX, get the result and operate accordingly. Javascript is executed on the client side and PHP on the server side, so there isn't a way to make Javascript execute a PHP file by itself. You can read more at:

    http://docs.jquery.com/Ajax

    Hope that helps,

    Zeldinha
     
    Zeldinha, Feb 10, 2008 IP
  3. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #3
    I can't use libraries...I just can't. I follow the tutorials exactly and they never work.

    So we'll pass by that. We'll go to number 2, and I'll try to explain in more detail:

    Say my PHP code is something like this:

    
    function test(){
    //Some Code
    }
    
    PHP:
    What I want to do is execute test() - because I do not want to store the code in a PHP file that can be accessed by the user. I can use a few PHP workarounds to stop direct access to the file, but it would be a feature I'd like to be able to utilise in Ajax. Though if its not possible, not much I can do about it.

    Thanks for your help.

    BP
     
    blueparukia, Feb 10, 2008 IP
  4. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I use prototype for my ajax functions and overall it has some very nice functions. The only thing I don't like about it is that it's pretty large. It's over 100kb. It's not that big of a deal for me since my script is hosting videos and all visitors generally have fast connections.

    I couldn't any of the examples to work either. I finally had to pay someone to help me integrate ajax into my script.

    I wanted to use mootools but it wont allow you get xml just plain text. I couldn't figure it out any way.
     
    SGBoise, Aug 12, 2008 IP
  5. koolman

    koolman Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    koolman, Aug 12, 2008 IP