Posts Tagged ‘ajax’

It’s a bit of a head-scratcher at first, seeing as the jQuery docs mysteriously disavow a postJSON possibility, let alone a function, but it’s definitely doable. So here’s the glorious code:
function postjson(url,data,bS,s,e){
$.ajax({type:”POST”,url:url,data:data,dataType:”json”,
beforeSend:bS,success:s,error:e});}
Use it like so:
postjson(“name.php”,”name=Bob”,
function(){$(“#name”).text(“…”);},
function(json){$(“#name”).text(json.name);},
function(){$(“#name”).text(“Error”);});
If name.php’s output looks like this…
{“name”:”Bob”}
…the above should, upon execution, change the ID “name” to contain the text “Bob.” [...]


Since I feel like being critical today, I’ll also talk about Web 2.0, and more specifically, the proliferation of AJAX-using “functional” applications. Checking out the script.aculo.us framework, I can’t help feeling that Flash development has officially started to lose its prior glamor. Now that NASA has come out with a Web 2.0 AJAX version of [...]