To support Ajax you must some files in your module structure.
mymodule/pnjavascript/mymodule.js
mymodule/pnstyle/style.css (might be present already)
mymodule/pnajax.php
Contains the module specific javascript. It is recommended to move all Javascript into this file except the absolute minimum which has to go into the template:
var somedefine = ‘<!--[ pnml name=”_MYMOD_SOMEDEFINE” ]-->’
has to be stored in the template to enable multilanguage error / hints. You cannot define this in your external .js file.
Event.observe(window, ‘load’, function(){mymoduleinit();}, false);
adds an onload() eventhandler which is executed after the page has been completely loaded to init some defaults, add event observers, unhide buttons etc.
holds the CSS for your div’s etc.
Important and often used classes are
.invisible {
display:none;
}
.sortable {
cursor: move;
}
This is the entry point for Ajax functions in your module. All Httprequests have to be directed to ajax.php, see ajax.php for more information.