Al-Zuhri (may Allah have mercy on him) narrates it marfu' (attributed to the Prophet) that the Prophet (peace and blessings be upon him) forbade "slaughtering animals for the jinn." He said: When a house was bought, or a spring was dug out, or something similar (was done), they would slaughter an animal for it out of superstition.
Abu Ubayd (may Allah have mercy on him) said: People slaughtered only because (they feared that) if they did not do so, the jinn would harm them; so the Prophet (peace and blessings be upon him) abolished this and forbade it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الضحايا / 19352