I'm setting up a page with ajax, it has a modal register
I have a form that is in the file novo.php
and I need to include it in the modal.
The modal is created the moment the user clicks the registration button:
var inc = '<div class="modal"><p class="close_modal"></p><?="<?php include(\"View/Professor/novo.php\");?>"?></div>';
$(document).ready(function(){
$('#cadastro').click(function(){
$('article').prepend('<div class="dark"></div>');
$('article').prepend(inc);
});
});
The prepend()
puts the php code inside the modal as I want, but jquery escapes php
When I open the console I notice that jquery wrote the commented php:
<div class="modal">
<p class"close_modal"></p>
<!--<?php include("View/Professor/novo.php"); ?>-->
</div>
How to write php command inside Jquery without escaping them?