[jQuery] Jquery AJAX form submission
Hello,
I am currently using Jquery's post method to submit a form. And I use the responseText to update certain other DIV in the page. Since I am migrating the All-No-AJAX pages to AJAX pages, I am forced import the entire HTML (not data alone) with Javascript into the existing DOM. Unfortunately $(document).ready(function(){}) doesnt get executed upon successfully receiving AJAX response. I guess this is the normal behaviour. But I would want that Javascript to be executed. The form plugin doesnt come to rescue since it doesnt support HTML type. Kindly advice on the right strategy to use.
Work Around : To make it work, I have removed the $(document).ready() hook, and am calling the Javascript init() methods at the end of the page. I certainly know that this is not the correct approach.
<i> $("form").submit(function(){
if(!$("#eFrm").<b>valid</b>())
{
return <b>false</b>;
}
var pData = $("#eFrm").serialize();
$("div.mainContent").html("Loading....");
$.<b>post</b>( './search.html?ajax=true',pData,function(data){$("div.mainContent").html(data);},"html");
return <b>false</b>;
});<br clear="all">
</i>
--
Thanks
Ram