fatjoez wrote:
> Problem is, the externally linked login box even though EXACT same code as
> inline, when attempting to submit via the submit button, the associated
> function in document ready is not launched. So basically when launching the
> external AJAX requested login page, the submit button in it no longer works.
>
fatjoez,
The submit event is not getting attached to the submit button because
it is inserted AFTER (loaded remotely) you assign the event to login
button(s) via; $('.loginBtn').click(...)
There's two ways to go about this.
A) You can execute a custom ajax routine in an onOpen function which
assigns the submit event in a callback. Here's an example;
var onOpen = function(h) {
h.w.load('login.htm',function() {
$('.loginBtn',this).click(function(){ alert('worked?'); ... });
// note; the $('.loginBtn') selector is scoped to $('#loginBox') via
"this"
});
};
$('#loginBox').jqm({trigger: 'a.openLogin'},onOpen);
B) You can include script which assigns the submit event within the AJAX
response ( form HTML you are loading remotely). See the ajax example of
demonstration #3 "/True Modal/" @
http://dev.iceburg.net/jquery/jqModal/ . If you click to view remote
content -- you'll see that javascript is inlined (view source) as;
[[[ REMOTE FILE CONTENT ]]]
Want to see if jqModal supports nested focused windows?
<form method="post" action="">
<button name="yes" id="ex3ctrigger">Yes</button>
<button name="no">No</button>
</form>
<p><a href="dialog/ajax_ex3.html">Click here</a>
to view remote (ajax_ex3.html) content.</p>
<!-- javascript gets evaluated in typical ajax calls.
to prevent this, use a customized ajax function
(demonstrated in example 4) -->
<script type="text/javascript">
$('#ex3c').jqm({
trigger: '#ex3ctrigger',
overlay: 25,
overlayColor: '#eaffc3',
zIndex: 3005,
focus: true });
</script>
---
Cool?
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/