Hi,
I’m trying to use a php AJAX framework to build my module, but I still got no result... I tried SAJAX... the requests never got to the server and even when I put it in debug mode, I got no answers to my questions... in fact all got was... nothing.
then I found AJAX Agent. That framework is developed by people of good reputation and seemed perfectly simple to use. The thing is that the core script file (agent.php) give me an error when loaded in the manager... and I don’t know wich error because it tells me to look at the error log, but there is absolutely no log (and just to know that I needed to check out the logs, I needed to go in the frame’s source code because the error window of the manager was empty and screen wide...)
I’m about to throw my computer through the window... anyone can give me a hint, or suggest me a simple and effective AJAX framework compatible with PHP4 and MODx?
Thanks a real LOT in advance!
Blaise
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
did you use it inside the manager ?? I think it’s causing problems...
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
-
☆ A M B ☆
- 24,524 Posts
I’m basing all of my AJAX-based module on what I found here:
http://www.ajaxlessons.com/2006/02/18/ajax-workshop-2-building-tabbed-content/
and aside from some stupidities on my part, it’s working just fine. I’ve already got the category list taken from the database, and refreshed on clicking a "refresh" icon. It even has a neat little "loading..." tag that works great.
It uses Prototype, and seems perfectly happy with the version that comes with MODx.
function getCatList(id) {
var url = '../assets/modules/shopx/includes/catlist.php';
var pars = 'id=' + id;
var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showCatList} );
}
function showCatList (originalRequest) {
var newData = originalRequest.responseText;
$('load').style.display = 'none';
$('catList').innerHTML = newData;
}
catlist.php just queries the database, creates an unordered list, and prints it. Nothing fancy at all.
I’ve not tested it yet... but... maybe i’m dumb...
I was using the ’internal’ method of AjaxAgent and SAJAX that let you call the same page to process the data... as the AJAX call is a separate process, would it be possible that it get stopped because the session information is not available for that process??
I’m gonna try the ’external’ way of doing and let you know... if it still don’t work, I’m gonna go with Prototype, even if it looks a little more complicated.
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
Ok... so I’ll try with Prototype... I’m not very good at JavaScript but i’ll learn.. I guess it won’t be too long : I did a little bit of Java when I was in school:)
bye,
Blaise
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
-
☆ A M B ☆
- 24,524 Posts
Oh, dear... can we all repeat together, "Javascript is NOT Java!". If you go into it thinking that it is you will come to serious grief. For one thing, classes are nothing at all like classes in Java. Javascript is ECMAScript with a catchy name.
http://en.wikipedia.org/wiki/JavaScript For one thing, it uses a totally different object model.
Pay extra attention to the "prototype" concept. (not the Ajax/DOM scripting library!)
http://www.crockford.com/javascript/inheritance.html
I know

i was talking about the syntax that is the same (almost)... anyway, thank you!
P.S.: Don’t you ever sleep?? I always get a quick answer from you even if it’s 3AM here :p
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!