tags:

views:

35

answers:

1

Consider this code snippet:

transaction.executeSql(  
'SELECT * FROM pv_master;', [],  
    function(transaction, result) {  
        if(result.rows.length == 0) {  
        jQT.goTo("#register", 'slideup');  
        }  
    }, errorHandler  
);

This example is a little different to the question title as the square brackets should be filled with some value.

Imagine I didn't want a success callback but did want a failure callback, which comes second in this instance.

What would be the correct way to go about it?

A: 

In this case, you can simply put null, since the algorithm checks for this. I wrote a simple demo a while back that does this. If the function didn't check, you would pass an empty function:

function(){}

Note that you wouldn't need to worry about the parameter count, since it's okay to call a JS function with too many parameters.

Matthew Flaschen