getJSON success and error callback
I'm using getJSON to load data from the database onto a form. How can I specify the success & error callbacks?
here's the code I'm using:
EDIT: I managed to get the success callback by adding it below the $('fontSize')... but how can I set the error callback?
- $(function(){
$('#load').click(function(){
var configSelect = $('#configSelect').attr('value');
$.getJSON('load.php', { configSelect: configSelect }, function(data) {
$('#sections').val(data.Sections);
$('#fontColor').val(data.Fontcolor);
$('#bgcolor').val(data.BackgroundColor);
$('#font').val(data.Font);
$('#fontSize').val(data.FontSize);
$('#lineHeight').val(data.LineHight);
$('#letterSpacing').val(data.LetterSpacing);
$('#fontStyle').val(data.FontStyle);
});
});
});