Monday, April 14, 2008

URI limit in sajax

another embarrassingly simple fix which took me a little while to figure out:

While passing a hierarchical list to sajax to write to a file, I failed to get a return response. I thought this might have something to do with the heavily nested hiearchy which I was having problems with earlier in the day. As is often the case the reason was much simpler: by default sajax can only take a limited (and relatively small) number of characters in variables, since these are all being passed through the URI.

The solution here is to use post instead of get to send ajax requests. Here is a snippet to change that setting in your sajax head (probably at the top of your page):

$sajax_request_type = "POST";   // or "GET"
sajax_init();

No comments: