Any particular reason you need to do it this way. More usual to use an optocoupler with appropriate led resistor I would suggest around 2k2 to give around 10mA depending on which opto you use of course. This is a cheap, reliable and effective way to do it.
If you apply 24V at the gate, you are exceeding the maximum Vgs rating of +/- 10V (as given in the datasheet). This will cause the oxide of the MOSFET to damage & the MOSFET will fail.
I recommend using a DC to DC SSR (Solid State Relay). Again it uses a optocoupler for isolation & switching.
Any particular reason you need to do it this way. More usual to use an optocoupler with appropriate led resistor I would suggest around 2k2 to give around 10mA depending on which opto you use of course. This is a cheap, reliable and effective way to do it.
For N-Mosfet to ON, Vgs should be +ve and more than threshold value, in your case it is 2V. and max Vgs in this mosfet is 10V, so one thing is you should select a mosfet which will have Vgs more that 24V. or you can have volt. divider circuit to make 24v less than 10V.