Subscribe via RSS

jQuery getJSON() async false

Today I searched jQuery getJSON() async false because I needed my jQuery Ajax call to be synchronous. It turns out that getJSON is just an Ajax shortcut in jQuery that can not have any extra parameters passed to it according to a post at Stackoverflow.com and then confirmed in the jQuery doc . So I had to turn my call back to normal jQuery.ajax().

//before
$.getJSON(url, data, function(json){
                                //success code
                           });

//after
$.ajax({
  url: url,
  dataType: 'json',
  data: data,
  async: false,
  success: function(json){
                  //success code
               }
});

As you can see the shortcut code is well, shorter, but not as flexible as the basic ajax function. Shortcuts are nice but shouldn’t be leaned on for heavy lifting.

Round IE Corners

Today I searched Round IE Corners and found a solution that works great with jquery UI. CurvyCorners is a free JavaScript Library made to handle rounding on all browsers, even browsers that don’t support it. CurvyCorners will use the native css3 border-radius if available other wise it will add the images nessacary to round your element. All you need to do to implement CurvyCorners is add the JavaScript file and add a rounding css class to your elements that you want to round and Curvy does the rest. Below is an example of the CSS that jQuery uses to round corners that works perfectly with CurvyCorners.

.ui-corner-all {
 -moz-border-radius: 4px/*{cornerRadius}*/;
 -webkit-border-radius: 4px/*{cornerRadius}*/;
}