Ajax question
Am I understanding this right when it comes to doing an ajax call. If I only want to return certain data (not the whole shebang with header and footer crap), can't I just do this?
ob_clean();
add_my_shizzle();
obExit();
Does it not work that way? Trying to do some ajax stuff with some old code in SMF and am not able to figure this out.
Re: Ajax question
Reply #2 –
It sort of depends. Doing what Ema suggests will - at least assuming you haven't changed SMF too much - return a block of Content-Type: text/html, with no XML content type and no XML header. Trying to use it as XML may be... interesting. Certainly the core functions expect real XML which must be sent much as IchBin suggests (though you usually need to add a header() call to set Content-Type after the ob_clean call)
Look at how SMF/Elk does it, action=quotefast should be a good example.
Re: Ajax question
Reply #3 –
Thanks for the tips guys. I actually just applied this to the TinyPortal shoutbox as well. I hacked that ajax a while ago in a dirty way, and didn't like it much. Ema's little tip worked much better than what I was doing. I'll check out the xml way down the road when/if I rewrite stuff.