A measurement of the faint source correlation function in the GOODS and UDF surveys