I was working on a Login Form ( AJAX ) enabled. When a use clicks on link, that Login box, as a floating modal appears. The Content of that Login box is loaded from another page using jQuery's $().load function. On click of the link the Login Box loads. But, when I implemented AJAX submitting on that form:
$(document).ready(function(){
$("form#loginbox").submit(function(e){ e.preventDefault(); /*AJAX function here*/ });
});
But the form is submitted normally, without following what is given in the function, that is ( Prevent the Default - Submitting and use AJAX ). so does that mean the Loaded content is not considered inside DOM or the script cannot read it? I load the content only once:
$(document).ready(function(){
if($("#loadedform").html() == "")
{ $(this).load('/load/login.html'); }
$(".login-modal').slideDown('slow');
});
The structure:
<div class="login-modal"><div id="loadedform"></div></div>
the content to be loaded:
<form id="loginbox" method="post" action="xyz.html">
<!-- INPUT Boxes and Submit Button -->
</form>