Thanks for the comment Blair.
Your advice worked.
It seems strange to put a submit event handler in the callback function of a
.load because the submit event will not happen as soon as the .load is
complete. However, the submit event can happen anytime after the .load is
complete, so I guess that makes sense.
But then again, AJAX related coding is new to me.
Thanks again,
Roy
Blair McKenzie-2 wrote:
>
> You need to put this
> $("#submission_form").submit(function() {
> alert('click');
> });
> in the callback for the load. The order of things happening at the moment
> is
> probably something like:
> 1. Request form with .load
> 2. Attach event to all #submission_form's (of which there are none at the
> moment)
> 3. Receive the form back from load and add it
>
> By putting the bind in the callback, you can be sure that the request is
> compeleted first.
>
> Blair
>
> On 12/2/06, roykolak <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hello everybody,
>>
>> This question involves the following situation...
>>
>> The main html page has container divs that are blank.
>> When the page loads, a javascript function called 'pageLoad();' is
>> called.
>> This function fills a blank div called 'top' with a form.
>> It does this via .load('php/dspFrontPage.php')
>> dspFrontPage.php contains...
>>
>> <?
>> $toDisplay .= "<form id='submission_form'>";
>> $toDisplay .= "<input class='submission_firstSentence' type='text'
>> name='firstSentence' /><br />";
>> $toDisplay .= "<input type='submit' name='submit' value='Finish My
>> Sentence'
>> />";
>> $toDisplay .= '</form>';
>>
>> echo $toDisplay;
>> ?>
>>
>> This form contains a text input and a submit button, standard stuff.
>>
>> On the main html page just below pageLoad(), an event for the submission
>> of
>> the form is waiting...
>>
>> $("#submission_form").submit(function() {
>> alert('click');
>> });
>>
>>
>> The .load event works just fine
>>
>> The problem here is that when the form is submitted, the submit event is
>> never called. When I copy and paste the form into the main html page (not
>> using .load), everything works fine.
>>
>> I'm new to the AJAX 'stuff'. Is there something I am missing? Or not
>> getting
>> right?
>>
>> Roy Kolak
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/loading-content-and-using-events-tf2741280.html#a7648795
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/loading-content-and-using-events-tf2741280.html#a7656370
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/