Results 1 to 5 of 5

Thread: ajax.php how to use with jQuery DataTables

  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Default ajax.php how to use with jQuery DataTables

    Using version 3.0.11 OR

    Any one have experience using ajax.php.

    I have an addon and want to use dataTables. I am running this part of the addon in the OR admin section of the website. When a person clicks on my addon listed on the admin page the are taken to my addon admin page. This is where i want to use dataTables.

    I have set
    "sAjaxSource": "http://www.aaa.com/admin/ajax.php?action=ajax_run_aaa" in my script.

    I get json is null response from server.

    I have included the function name_run_action_ajax()
    to my addon and changed the name to my addon name.

    How do you use name_run_action_ajax do you use a switch statement to another function? like name_run_action_admin_template()

    What do we do from there? I see the addon manager is using ajax.php in the jquery request to the server.

    Any examples appreciated. Any documentation on Ajax.php appreciated.

    From Documentation:
    Ajax
    Open-Realty® 2.6 and later make use of several Ajax functions for numerous features in Open-Realty®. Add-ons can now make use of the "ajax.php" file and its functions included in Open-Realty®.

    The add-on will need to have a function named:

    name_run_action_ajax()

    name_ prefix should be changed to match the add-on and add-on folder name in the same method as other Add-on functions documented below.

    Thanks Mike...

  2. #2
    Join Date
    Jun 2004
    Posts
    1,067

    Default Re: ajax.php how to use with jQuery DataTables

    Mike,

    Ok so your addon.inc.php file need the ADDONNAME_run_action_ajax function. This is ADDONNAME_run_action_admin_template and would contain a switch to call what ever function in your script you need to trigger. Example.

    Code:
    function ADDONNAME_run_action_ajax(){
    global $config,$conn;
    $display = '';
    switch ($_GET['action'])
    {
        case 'addon_ADDONNAME_runme':
           $display = runme();
    }
    return $display;
    }
    
    function runme(){
    //Do Something.
    
    //If this is a Json Response we should set the headers.
    header('Content-type: application/json');
    //Build our Json Response
    $display = json_encode(array('error' => "0",'status_msg' => 'I was Run'));
    return $display
    }
    You would call this by doing
    http://yoursite.com/admin/ajax.php?action=addon_ADDONNAME_runme

  3. #3
    Join Date
    Jan 2009
    Posts
    6

    Default Re: ajax.php how to use with jQuery DataTables

    Thanks Ryan this is exactly what I needed to know...

  4. #4
    Join Date
    Jun 2004
    Posts
    1,067

    Default Re: ajax.php how to use with jQuery DataTables

    Happy to help. I am going to move the thread over the addon forum. If you have any other questions please let me know.

  5. #5
    Join Date
    May 2011
    Posts
    4

    Default Re: ajax.php how to use with jQuery DataTables

    what if someone wants to make ajax calls in uesr end ??

Similar Threads

  1. jQuery slidedown Login not working
    By iciman in forum Addon help, ideas and discussion (CLOSED)
    Replies: 7
    Last Post: 01-10-2011, 11:10 AM
  2. Ajax / jQuery issue within Admin
    By bluewebco in forum Installation/Configuration Help
    Replies: 7
    Last Post: 09-03-2010, 06:03 AM
  3. Using jQuery
    By tatebn in forum General Help (CLOSED)
    Replies: 2
    Last Post: 05-01-2009, 01:37 PM
  4. Jquery or prototype framesworks
    By pearance in forum General Help (CLOSED)
    Replies: 6
    Last Post: 09-09-2007, 05:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •