![]() |
|
AJAX not working due to var uri not set - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: AJAX not working due to var uri not set (/thread-84.html) |
AJAX not working due to var uri not set - zatacka - 2005-10-04 Seems there are many reasons AJAX may not work. I managed to isolate my problem down to sajax_get_my_uri() in sajax.php. It wasn't returning anything. As such the uri var in the JS wasn't set, and(I'm guessing, as I don't know AJAX) the script didn't know where to send it's input. Well, anyway, I replaced `function sajax_get_my_uri() { global $REQUEST_URI;` `return $REQUEST_URI; }` with `function sajax_get_my_uri() { /*global $REQUEST_URI;` `return $REQUEST_URI;*/ return $_SERVER["REDIRECT_SCRIPT_URI"]."?".$_SERVER["REDIRECT_QUERY_STRING"]; }` and now it works beautifully. Now, I don't know AJAX, so for all know, giving it the whole uri might be overkill, so I'll leave the actual bugfixing to Tristan. Edit: Oh, I almost forgot, you can check if your uri variable is set by viewing the source and searching(Ctrl+F) for `uri = "`. If it just says `uri = "";` you will probably have to fix it. AJAX not working due to var uri not set - trisweb - 2005-10-05 Wow, interesting. Sajax always seemed kind of hacky to me. I'm looking for other libraries that might be better.... AJAX not working due to var uri not set - Tobi_Kellner - 2006-01-08 Yes, I also discovered that one after half a day of debugging :-) I put in function sajax_get_my_uri() { global $_SERVER; return $_SERVER['REQUEST_URI']; } and it works fine. I guess the reason is that $REQUEST_URI is a shortcut for $_SERVER['REQUEST_URI'], which is set in some versions of PHP and not in others. On a slightly different note, the debug mode cannot be activated, setting $sajax_debug_mode = 1 does not work (weird, the code looks ok), so you'll have to set it in line 86 manually. Tobi AJAX not working due to var uri not set - Tobi_Kellner - 2006-01-08 |