I have nav tabs on left side and i am loading content on right side.
I have attched the click event by using live but how can attach these type of functions
$('#form').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
$("#dialog-confirm").dialog({
resizable: true,
autoOpen: false,
height:427,
width:650,
modal: true,
buttons: { "Ok": function() { $(this).dialog("close"); },
"Cancel": function() { $(this).dialog("close"); } },
});
also do i need to attach ajaxoptions as well
When you load new content, you must re-apply things like “.dialog()” from your own code. Generally, you’d do that in the “success” handler from the ajax mechanism you used to load the content.
What that means is that it’s a really good idea to organize your page “widget” setup code so that it can be invoked to operate on an arbitrary portion of the page. At page initialization time, you’ll run it against the
<body>, but after a dynamic content load you’d run it against the container element that you’ve updated.edit — more detail: exactly how you go about doing this is up to you, and it depends on the kinds of things you do in your application. I wrote a jQuery plugin to handle the problem, but that might be overkill for a lot of purposes.
The general idea is that you’d have an initialization function:
Inside the function, you’d do things like initialize dialogs, and you’d base the code that does the work off the “startingPoint” parameter. In other words, when the code has to “find” page elements to set up, it should always start from there:
Then, in your “success” handler after you’ve loaded content, you can just call your function again:
Again, it completely depends on the exact details of your application.