I'm using AJAX to fetch a form dynamically into another page for security reasons. The Ajax works fine but the result is displaying form elements only not the form tag
$.ajax('form.php?username='+username).done(function (data) {
alert(data);
$("#test").html(data);
})
The alert displays the whole form including the form tag with the related attributes but the form does not submit because the form tag has been removed and while checking the code through firebug that's what I found

and this the result of alert(data)

I've tried this but it didn't insert the form tag at all
$("#test").html(data).promise().done(function(){
$("#test").html.wrap('<form action="page.php">');
});
A FORM cannot contains any other FORM, see Spec
form must not contain other form elements.
Browser engine strips out any nested FORM tags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With