Re: HTML_AJAX + JSON
| From: | Joshua Eichorn | Date: | Mon, 06 Feb 2006 01:20:20 +0000 |
| Subject: | Re: HTML_AJAX + JSON | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22812@lists.php.net to get a copy of this message | ||
You have a couple options but the easiest is to register a class for AJAX use and use the automatically generated stub class.
There is an example at: http://blog.joshuaeichorn.com/archives/2005/08/17/ajax-hello-world-with-html_ajax/
There isn't currently any code to automatically handle this case without dispatching to a registered class but you could handle that pretty easily by using the HTML_AJAX class directly instead of wrapped inside inside HTML_AJAX_Server
-josh
Adam Maccabee Trachtenberg wrote:
I want to convert my AJAX application to use HTML_AJAX. Here's how I have things set up right now (pre HTML_AJAX): 1. Manually create a GET request 2. Submit it using XMLHttpRequest 3. Process it using PHP and convert the results to JSON 4. eval() the JSON in a callback function and operate on the results Can someone point me at an example showing me how to do this using HTML_AJAX? All the examples I can find generally assume you're sending back HTML and want to shove it into a div. I don't want this because I want to be able to manipulate the data on the client w/o refetching it from the server. (I also need to be able to pass parameters to the server.) I feel HTML_AJAX should be able to handle the JSON (de)serialization for me and let me operate on it within a callback, but I'm not quite sure how. Thanks. -adam