Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Ajax+vanilla

edited December 2007 in Vanilla 1.0 Help
I've developed with ajax erlier. It was a system that we created from scratch and I used Sajax to implement my ajax-functions. Now I wan't to use ajax in my vanilla extension and I've read som extensions like the ajaxquote but I doesn't look anything like the code I've written when I used sajax. Is there any documentation how to implement ajax-solutions in vanilla? What does the /js/ajax.js do? And what does init_ajax.php do? I've very grateful for any help, sorry my bad English.

Comments

  • There are three init_*.php files which inits Vanilla application.
    There is normal initialization (init_vanilla.php), initialization when you are logging in/out (init_people.php called by people.php) and initialization when Vanilla is called by ajax (init_ajax.php)

    For example in init_ajax.php there are extensions (their default.php files) not loaded, because it was often causing problems.

    init_ajax.php is called for example when you enable/disable an extension.

    You can include init_ajax.php in your php file called by ajax so Vanilla is correctly initialized (creates $Context)

    I can see there is often used this at the beginning of by-ajax called php file:include('../../appg/settings.php'); include('../../appg/init_ajax.php'); so then you have $Context available.

    ajax.js defines DataManager class, which afaik helps you use ajax easily (kind of a ajax framework). But you can use your own js file with your own ajax functions (e.g. Sajax)

    Take a look at some other extensions using ajax (UserInfoTooltip, Attachments, Poll, ReportPost...)

    There is also JQuery extension which provides some ajax management and also scriptaculous (which is sometimes used by some extensions) provides some ajax functions.
  • Ahh great. Thank you very much. I've looked at the report but the ajax function doesn't return anything or am I missing something? When I more or less copy the AjaxQuote the request.responseText just is undefined. Howcome? function ajaxtest(){ var dm = new DataManager(); dm.RequestCompleteEvent = printajax; dm.RequestFailedEvent = printerrorajax; dm.LoadData('/extensions/AjaxQuote/ajax.php?CommentID=37'); } function printajax(request){ var div=document.getElementById("testajax"); div.innerHTML=request.responeText; return false; }
  • nm, it works now.
This discussion has been closed.