jazz_snob
01-13-2008, 02:50 AM
I hate javascript. Fortunately there is the prototype library. Now I'm hooked on ajax.
Presently, I'm having the server response be plain ol' HTML that I update some container (div, tr, whatever) with. But its limiting. For example, suppose the user is submitting a form and their could be a server-side error or it might succeed. So in one case I need to return the error message and display it. In the case of success I need to update some other part of the page w/ new data. I experimented w/ sending back some JSON code, but I ran into problems w/ Internet Exploder.
I just read this fine article:
http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon.html
So I would like to ask the phpbuilder.com community what approaches have they used successfully. As mentioned, I'm just sending back plain HTML. One thing I'm doing on 'success' is to prefix the HTML w/ the string '_success=' which the js code strips out before displaying. Without that string present the js code knows to update the error <div> w/ whatever the server returned.
Thanks!
Presently, I'm having the server response be plain ol' HTML that I update some container (div, tr, whatever) with. But its limiting. For example, suppose the user is submitting a form and their could be a server-side error or it might succeed. So in one case I need to return the error message and display it. In the case of success I need to update some other part of the page w/ new data. I experimented w/ sending back some JSON code, but I ran into problems w/ Internet Exploder.
I just read this fine article:
http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon.html
So I would like to ask the phpbuilder.com community what approaches have they used successfully. As mentioned, I'm just sending back plain HTML. One thing I'm doing on 'success' is to prefix the HTML w/ the string '_success=' which the js code strips out before displaying. Without that string present the js code knows to update the error <div> w/ whatever the server returned.
Thanks!