login
moments in facepalm - PHP return vs. die() posted: Sat 2013-06-22 17:45:22 tags: tech
After all my wrestling with jQuery's "promise" interface - which, for all my wrestling, is STILL rather alien - after rewriting my collision-avoidance logic in jqXHR terms, I still wasn't getting data back from the second PHP middleware resource.

Then I changed the way that script returned its results, from
return $reply;
to
die($reply);

...

Yeah, that fixed it.

Now, the jQuery autodidaction wasn't a total waste, of course, because there are still plenty of instances where you need to make sure one async call is resolved before you try to use its results. But really, why couldn't the PHP part of the problem made itself more evident weeks ago?